# ttaulli/agents-book architecture

> Architecture diagram of the GitHub repository ttaulli/agents-book, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ttaulli/agents-book
- Repository: https://github.com/ttaulli/agents-book

## Overview

##### Project type and purpose
- From the file tree and README, this “agents-book” repository is an open-source, notebook-driven content-generation pipeline. It uses Jupyter notebooks to demonstrate and orchestrate AI agent patterns (LangChain, AutoGen, ReAct, Haystack) for writing chapters, translating text, performing market research, and building a book.

##### File structure
- Top-level notebooks (.ipynb) implement examples and chapters (e.g., “Chapter 7 – LangChain Program for Translation.ipynb,” “CrewAI.ipynb,” “ReAct Agent.ipynb”).
- A `.cache` folder and `.ipynb_checkpoints` are incidental Jupyter artifacts.
- The `db/` directory holds a Chroma-based vector store (SQLite and binary files) for retrieval-augmented generation.
- Miscellaneous resource files: `market_research.json`, `product_definition.json`, `books_output.csv`, `sample_document.html`, `images/` for the book’s assets.
- A simple README with the project title and cover image.

##### README for additional insights
- The README confirms this is not a full MVC application but an educational/demo toolkit for AI agents generating book content.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface
    UserAuthor["User/Author"]:::ui

    %% Notebook Workflows
    subgraph "Jupyter Notebook Workflows"
        direction TB
        LangChainNb["LangChain.ipynb"]:::ui
        Chapter7["Chapter 7 - LangChain Program for Translation.ipynb"]:::ui
        AutoGenNb["AutoGen.ipynb"]:::ui
        AutogenWebNb["Autogen_WebSearchAgent.ipynb"]:::ui
        ReActNb["ReAct Agent.ipynb"]:::ui
        HaystackNb["Haystack.ipynb"]:::ui
        HaystackFuncNb["Haystack_Agent_Function_Calling.ipynb"]:::ui
        OpenAINb["OpenAI API.ipynb"]:::ui
        AssistantsNb["Assistants API.ipynb"]:::ui
    end

    %% Agent Orchestrator
    subgraph "Agent Orchestrator" 
        direction TB
        PromptBuilder["Prompt Builder"]:::orchestrator
        EmbeddingRetrieval["Embedding Retrieval"]:::orchestrator
        ResponseProcessor["Response Processor"]:::orchestrator
    end

    %% External AI Services
    subgraph "External AI APIs"
        OpenAIAPI["OpenAI API"]:::external
    end

    %% Vector Database
    subgraph "Vector Database (Chroma)"
        ChromaDB["Chroma Vector DB"]:::persistence
    end

    %% File System Inputs
    subgraph "File System Inputs"
        direction TB
        MarketResearch["market_research.json"]:::persistence
        ProductDef["product_definition.json"]:::persistence
        ContentPlan["content_plan.txt"]:::persistence
        ExampleTxt["example.txt"]:::persistence
    end

    %% File System Outputs
    subgraph "File System Outputs"
        direction TB
        BooksOutput["books_output.csv"]:::persistence
        SampleDoc["sample_document.html"]:::persistence
        OutreachReport["outreach_report.md"]:::persistence
        ImagesDir["images/"]:::persistence
    end

    %% Documentation
    Readme["README.md"]:::persistence

    %% Connections
    UserAuthor -->|"launches notebooks"| LangChainNb
    UserAuthor --> Chapter7
    UserAuthor --> AutoGenNb
    UserAuthor --> AutogenWebNb
    UserAuthor --> ReActNb
    UserAuthor --> HaystackNb
    UserAuthor --> HaystackFuncNb
    UserAuthor --> OpenAINb
    UserAuthor --> AssistantsNb

    LangChainNb -->|"orchestrates"| PromptBuilder
    Chapter7 --> PromptBuilder
    AutoGenNb --> PromptBuilder
    AutogenWebNb --> PromptBuilder
    ReActNb --> PromptBuilder
    HaystackNb --> PromptBuilder
    HaystackFuncNb --> PromptBuilder
    OpenAINb --> PromptBuilder
    AssistantsNb --> PromptBuilder

    ContentPlan --> PromptBuilder
    ExampleTxt --> PromptBuilder
    MarketResearch --> PromptBuilder
    ProductDef --> PromptBuilder

    PromptBuilder -->|"builds prompts"| EmbeddingRetrieval
    EmbeddingRetrieval -->|"get embeddings"| OpenAIAPI
    EmbeddingRetrieval -->|"query similarity"| ChromaDB
    ChromaDB -->|"results"| EmbeddingRetrieval

    PromptBuilder -->|"send chat/completion"| OpenAIAPI

    OpenAIAPI -->|"responses"| ResponseProcessor
    EmbeddingRetrieval --> ResponseProcessor

    ResponseProcessor -->|"save outputs"| BooksOutput
    ResponseProcessor --> SampleDoc
    ResponseProcessor --> OutreachReport
    ResponseProcessor --> ImagesDir

    Readme --> UserAuthor

    %% Click Events
    click LangChainNb "https://github.com/ttaulli/agents-book/blob/main//LangChain.ipynb"
    click Chapter7 "https://github.com/ttaulli/agents-book/blob/main//Chapter 7 - LangChain Program for Translation.ipynb"
    click AutoGenNb "https://github.com/ttaulli/agents-book/blob/main//AutoGen.ipynb"
    click AutogenWebNb "https://github.com/ttaulli/agents-book/blob/main//Autogen_WebSearchAgent.ipynb"
    click ReActNb "https://github.com/ttaulli/agents-book/blob/main//ReAct Agent.ipynb"
    click HaystackNb "https://github.com/ttaulli/agents-book/blob/main//Haystack.ipynb"
    click HaystackFuncNb "https://github.com/ttaulli/agents-book/blob/main//Haystack_Agent_Function_Calling.ipynb"
    click OpenAINb "https://github.com/ttaulli/agents-book/blob/main//OpenAI API.ipynb"
    click AssistantsNb "https://github.com/ttaulli/agents-book/blob/main//Assistants API.ipynb"
    click ChromaDB "https://github.com/ttaulli/agents-book/tree/main//db"
    click MarketResearch "https://github.com/ttaulli/agents-book/blob/main//market_research.json"
    click ProductDef "https://github.com/ttaulli/agents-book/blob/main//product_definition.json"
    click ContentPlan "https://github.com/ttaulli/agents-book/blob/main//content_plan.txt"
    click ExampleTxt "https://github.com/ttaulli/agents-book/blob/main//example.txt"
    click BooksOutput "https://github.com/ttaulli/agents-book/blob/main//books_output.csv"
    click SampleDoc "https://github.com/ttaulli/agents-book/blob/main//sample_document.html"
    click OutreachReport "https://github.com/ttaulli/agents-book/blob/main//outreach_report.md"
    click ImagesDir "https://github.com/ttaulli/agents-book/tree/main//images"
    click Readme "https://github.com/ttaulli/agents-book/blob/main//README.md"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef orchestrator fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
    classDef persistence fill:#D3D3D3,stroke:#333,stroke-width:1px
```
