# langwatch/create-agent-app architecture

> Architecture diagram of the GitHub repository langwatch/create-agent-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langwatch/create-agent-app
- Repository: https://github.com/langwatch/create-agent-app

## Overview

##### Project type and purpose
- This is a mono‑repo of multiple “Customer Support Agent” examples, each built with a different LLM‑agent framework (DSPy, Google ADK, InspectAI, LangGraph functional & high‑level, Pydantic AI, smolagents).
- Its purpose is to provide side‑by‑side templates showing how to implement the same agent logic in each framework, sharing common mocks and knowledge‑base data.

##### File structure
- Top‑level directories:
- create_agent_app/common – shared code (mocked APIs, knowledge base)
- dspy_example, google_adk_example, inspect_ai_example, langgraph_functional_api_example, langgraph_highlevel_api_example, pydantic_ai_example, smolagents_example – each contains one agent implementation, its pyproject.toml, tests, and lockfile.
- Root files: .env.example, Makefile, uv.lock, pyproject.toml – define environment, build/test scripts, dependency management.
- Tests live under each example/tests and drive the agent workflow.
- The common folder holds static knowledge_base markdown files and a mocked_apis.py to simulate external systems.

##### README for additional insights
- Describes the process: clone → cd into an example → uv sync → pytest.
- Emphasizes that examples should remain self‑contained and nearly identical in behavior, differing only in framework calls.
- Notes all use the same Gemini model endpoint and Scenario tests.

a. Main components:
- Example Agents (one container per framework)
- Shared Common Library (mocked‑apis + knowledge_base)
- External LLM API (Google Gemini)
- Test Harness (pytest driven by uv)
- CI/Build Orchestrator (Makefile / uv commands)
b. Relationships & interactions:
1. Test Harness invokes a given Example Agent.
2. Example Agent imports shared logic from Common Library.
3. Agent logic calls the external LLM API with prompts assembled from knowledge_base.
4. External LLM returns responses, Agent processes and returns to Test Harness.
5. CI/Build Orchestrator orchestrates dependency install (uv sync), test execution, and linting.
c. Architectural patterns & design principles:
- Modular per‑framework containers – supports plug‑and‑play and side‑by‑side comparison.
- Layered separation:
1. Presentation (Test Harness)
2. Application (Agent code in each example)
3. Shared Service (Common library)
4. External Systems (LLM, real APIs vs mocks)
- Single Responsibility: each example only handles framework‑specific orchestration, while common code centralizes mocks and static data.
d. Key technologies:
- Python packaging: pyproject.toml, uv.lock
- Test runner: pytest (invoked via uv)
- LLM endpoint: Gemini‑2.5 flash preview
- Framework SDKs: dsp, google adk, inspect_ai, langgraph, pydantic_ai, smolagents

##### Elements
- From Test Harness → Example Agent
- From Example Agent → Common Library
- From Example Agent (or Common) → External LLM API
- From CI Orchestrator → Test Harness & Install step

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Test Harness Layer
    subgraph "Test Harness"
        DSpyTest["dspy_example/tests/test_customer_support_agent.py"]:::test
        click DSpyTest "https://github.com/langwatch/create-agent-app/blob/main/dspy_example/tests/test_customer_support_agent.py"
        GoogleADKTest["google_adk_example/tests/test_customer_support_agent.py"]:::test
        click GoogleADKTest "https://github.com/langwatch/create-agent-app/blob/main/google_adk_example/tests/test_customer_support_agent.py"
        InspectAITest["inspect_ai_example/tests/test_customer_support_agent.py"]:::test
        click InspectAITest "https://github.com/langwatch/create-agent-app/blob/main/inspect_ai_example/tests/test_customer_support_agent.py"
        LGFuncTest["langgraph_functional_api_example/tests/test_customer_support_agent.py"]:::test
        click LGFuncTest "https://github.com/langwatch/create-agent-app/blob/main/langgraph_functional_api_example/tests/test_customer_support_agent.py"
        LGHighTest["langgraph_highlevel_api_example/tests/test_customer_support_agent.py"]:::test
        click LGHighTest "https://github.com/langwatch/create-agent-app/blob/main/langgraph_highlevel_api_example/tests/test_customer_support_agent.py"
        PydanticTest["pydantic_ai_example/tests/test_customer_support_agent.py"]:::test
        click PydanticTest "https://github.com/langwatch/create-agent-app/blob/main/pydantic_ai_example/tests/test_customer_support_agent.py"
        SmolTest["smolagents_example/tests/test_customer_support_agent.py"]:::test
        click SmolTest "https://github.com/langwatch/create-agent-app/blob/main/smolagents_example/tests/test_customer_support_agent.py"
    end

    %% Agent Implementations Layer
    subgraph "Agent Implementations"
        DSpyAgent["dspy_example/customer_support_agent.py"]:::agent
        click DSpyAgent "https://github.com/langwatch/create-agent-app/blob/main/dspy_example/customer_support_agent.py"
        GoogleADKAgent["google_adk_example/customer_support_agent.py"]:::agent
        click GoogleADKAgent "https://github.com/langwatch/create-agent-app/blob/main/google_adk_example/customer_support_agent.py"
        InspectAIAgent["inspect_ai_example/customer_support_agent.py"]:::agent
        click InspectAIAgent "https://github.com/langwatch/create-agent-app/blob/main/inspect_ai_example/customer_support_agent.py"
        LGFuncAgent["langgraph_functional_api_example/customer_support_agent.py"]:::agent
        click LGFuncAgent "https://github.com/langwatch/create-agent-app/blob/main/langgraph_functional_api_example/customer_support_agent.py"
        LGHighAgent["langgraph_highlevel_api_example/customer_support_agent.py"]:::agent
        click LGHighAgent "https://github.com/langwatch/create-agent-app/blob/main/langgraph_highlevel_api_example/customer_support_agent.py"
        PydanticAgent["pydantic_ai_example/customer_support_agent.py"]:::agent
        click PydanticAgent "https://github.com/langwatch/create-agent-app/blob/main/pydantic_ai_example/customer_support_agent.py"
        SmolAgent["smolagents_example/customer_support_agent.py"]:::agent
        click SmolAgent "https://github.com/langwatch/create-agent-app/blob/main/smolagents_example/customer_support_agent.py"
    end

    %% Shared Common Library
    subgraph "Shared Common Library"
        MockedAPIs["Mocked APIs"]:::common
        click MockedAPIs "https://github.com/langwatch/create-agent-app/blob/main/create_agent_app/common/cutomer_support/mocked_apis.py"
        KnowledgeBase["Knowledge Base"]:::common
        click KnowledgeBase "https://github.com/langwatch/create-agent-app/tree/main/create_agent_app/common/cutomer_support/knowledge_base/"
    end

    %% External LLM Service
    ExternalLLM["Google Gemini API"]:::external

    %% CI / Build Orchestrator
    CICLI["Make & uv CLI"]:::ci
    click CICLI "https://github.com/langwatch/create-agent-app/tree/main/Makefile"

    %% Connections: Test -> Agent
    DSpyTest -->|"runs"| DSpyAgent
    GoogleADKTest -->|"runs"| GoogleADKAgent
    InspectAITest -->|"runs"| InspectAIAgent
    LGFuncTest -->|"runs"| LGFuncAgent
    LGHighTest -->|"runs"| LGHighAgent
    PydanticTest -->|"runs"| PydanticAgent
    SmolTest -->|"runs"| SmolAgent

    %% Connections: Agent -> Common Library
    DSpyAgent -->|"imports"| MockedAPIs
    DSpyAgent -->|"imports"| KnowledgeBase
    GoogleADKAgent -->|"imports"| MockedAPIs
    GoogleADKAgent -->|"imports"| KnowledgeBase
    InspectAIAgent -->|"imports"| MockedAPIs
    InspectAIAgent -->|"imports"| KnowledgeBase
    LGFuncAgent -->|"imports"| MockedAPIs
    LGFuncAgent -->|"imports"| KnowledgeBase
    LGHighAgent -->|"imports"| MockedAPIs
    LGHighAgent -->|"imports"| KnowledgeBase
    PydanticAgent -->|"imports"| MockedAPIs
    PydanticAgent -->|"imports"| KnowledgeBase
    SmolAgent -->|"imports"| MockedAPIs
    SmolAgent -->|"imports"| KnowledgeBase

    %% Connections: Agent -> External LLM
    DSpyAgent -->|"calls"| ExternalLLM
    GoogleADKAgent -->|"calls"| ExternalLLM
    InspectAIAgent -->|"calls"| ExternalLLM
    LGFuncAgent -->|"calls"| ExternalLLM
    LGHighAgent -->|"calls"| ExternalLLM
    PydanticAgent -->|"calls"| ExternalLLM
    SmolAgent -->|"calls"| ExternalLLM

    %% Connections: CI -> Test Harness
    CICLI -->|"executes"| DSpyTest
    CICLI -->|"executes"| GoogleADKTest
    CICLI -->|"executes"| InspectAITest
    CICLI -->|"executes"| LGFuncTest
    CICLI -->|"executes"| LGHighTest
    CICLI -->|"executes"| PydanticTest
    CICLI -->|"executes"| SmolTest

    %% Styling
    classDef agent fill:#f9f,stroke:#333,stroke-width:1px
    classDef common fill:#9f9,stroke:#333,stroke-width:1px
    classDef external fill:#9cf,stroke:#333,stroke-width:1px
    classDef test fill:#fc9,stroke:#333,stroke-width:1px
    classDef ci fill:#cff,stroke:#333,stroke-width:1px
```
