# bbzet/ai-agentic-labs architecture

> Architecture diagram of the GitHub repository bbzet/ai-agentic-labs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bbzet/ai-agentic-labs
- Repository: https://github.com/bbzet/ai-agentic-labs

## Overview

AI Agentic Labs is a set of four educational prototypes, not one deployed application. The documented progression covers comparing LLM providers, structured extraction, an Ollama agent using an MCP document-search server, and a ReAct agent with search and calculator tools. In the latter workflow, the agent asks an LLM for an action, invokes a tool, feeds back its observation, and returns a final answer; it also records run data for analysis. The graph preserves all four labs. Lab 1 and 2 internals are unsampled, so their documented capabilities are represented at notebook level.

Main entry points: [`lab_4/agent.py`](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/agent.py) (ReAct agent), [`lab_3/agent.py`](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_3/agent.py) (MCP agent), [`lab_1/lab_1.ipynb`](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_1/lab_1.ipynb) (Model comparison), [`lab_2/lab_2.ipynb`](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_2/lab_2.ipynb) (Structured extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_labs1_2["LLM experiments"]
  node_lab1["Model comparison<br/>[lab_1.ipynb]"]
  node_lab2["Structured extraction<br/>[lab_2.ipynb]"]
end

subgraph group_lab3["MCP document agent"]
  node_lab3_agent["MCP agent<br/>[agent.py]"]
  node_mcp_server["MCP search server<br/>[server.py]"]
  node_lab3_docs["Company documents"]
end

subgraph group_lab4["ReAct agent"]
  node_react_agent["ReAct agent<br/>[agent.py]"]
  node_agent_tools["Agent tools<br/>[tools.py]"]
  node_lab4_docs["Company documents"]
  node_run_log[("Run log<br/>[agent_log.jsonl]")]
end

subgraph group_analysis["Run analysis"]
  node_analyzer["Run analyzer<br/>[analyze.py]"]
end

node_learner(("User"))
node_llm_providers{{"LLM providers"}}
node_lab3_user(("Employee"))
node_ollama{{"Ollama model"}}
node_lab4_user(("User"))
node_llm_service{{"LLM service"}}

node_learner -->|"compares models"| node_lab1
node_lab1 -->|"queries providers"| node_llm_providers
node_learner -->|"submits data"| node_lab2
node_lab2 -->|"uses extraction"| node_llm_providers
node_lab3_user -->|"asks question"| node_lab3_agent
node_lab3_agent -->|"queries model"| node_ollama
node_lab3_agent -->|"calls tools"| node_mcp_server
node_mcp_server -->|"searches files"| node_lab3_docs
node_lab4_user -->|"asks question"| node_react_agent
node_react_agent -->|"requests actions"| node_llm_service
node_react_agent -->|"dispatches actions"| node_agent_tools
node_agent_tools -->|"searches documents"| node_lab4_docs
node_react_agent -->|"appends events"| node_run_log
node_analyzer -->|"reads events"| node_run_log

click node_lab1 "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_1/lab_1.ipynb"
click node_lab2 "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_2/lab_2.ipynb"
click node_lab3_agent "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_3/agent.py"
click node_mcp_server "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_3/server.py"
click node_lab3_docs "https://github.com/bbzet/ai-agentic-labs/tree/main/lab_3/docs"
click node_react_agent "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/agent.py"
click node_agent_tools "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/tools.py"
click node_lab4_docs "https://github.com/bbzet/ai-agentic-labs/tree/main/lab_4/docs"
click node_run_log "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/agent_log.jsonl"
click node_analyzer "https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/analyze.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_lab1,node_lab2,node_learner,node_lab4_user toneBlue
class node_lab3_agent,node_mcp_server,node_lab3_docs toneAmber
class node_react_agent,node_agent_tools,node_lab4_docs,node_run_log toneMint
class node_analyzer toneRose
class node_llm_providers,node_lab3_user,node_ollama,node_llm_service toneIndigo
```

## Components

### LLM experiments

- [Model comparison](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_1/lab_1.ipynb): `lab_1/lab_1.ipynb`
- [Structured extraction](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_2/lab_2.ipynb): `lab_2/lab_2.ipynb`

### MCP document agent

- [MCP agent](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_3/agent.py): `lab_3/agent.py`
- [MCP search server](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_3/server.py): `lab_3/server.py`
- [Company documents](https://github.com/bbzet/ai-agentic-labs/tree/main/lab_3/docs): `lab_3/docs`

### ReAct agent

- [ReAct agent](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/agent.py): `lab_4/agent.py`
- [Agent tools](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/tools.py): `lab_4/tools.py`
- [Company documents](https://github.com/bbzet/ai-agentic-labs/tree/main/lab_4/docs): `lab_4/docs`
- [Run log](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/agent_log.jsonl): `lab_4/agent_log.jsonl`

### Run analysis

- [Run analyzer](https://github.com/bbzet/ai-agentic-labs/blob/main/lab_4/analyze.py): `lab_4/analyze.py`

### Other components

- **User**
- **LLM providers**
- **Employee**
- **Ollama model**
- **User**
- **LLM service**

## Connections

- User → Model comparison: compares models (evidence: `README.md`)
- Model comparison → LLM providers: queries providers (evidence: `README.md`)
- User → Structured extraction: submits data (evidence: `README.md`)
- Structured extraction → LLM providers: uses extraction (evidence: `README.md`)
- Employee → MCP agent: asks question (evidence: `lab_3/agent.py`)
- MCP agent → Ollama model: queries model (evidence: `lab_3/agent.py`)
- MCP agent → MCP search server: calls tools (evidence: `lab_3/agent.py`)
- MCP search server → Company documents: searches files (evidence: `lab_3/server.py`)
- User → ReAct agent: asks question (evidence: `lab_4/agent.py`)
- ReAct agent → LLM service: requests actions (evidence: `lab_4/agent.py`)
- ReAct agent → Agent tools: dispatches actions (evidence: `lab_4/agent.py`)
- Agent tools → Company documents: searches documents (evidence: `lab_4/tools.py`)
- ReAct agent → Run log: appends events (evidence: `lab_4/agent.py`)
- Run analyzer → Run log: reads events (evidence: `lab_4/analyze.py`)
