# thirumurugan240/local_ai_agent architecture

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

- Interactive diagram: https://gitdiagram.com/thirumurugan240/local_ai_agent
- Repository: https://github.com/thirumurugan240/local_ai_agent

## Overview

This repository provides two local chat apps: a single-agent answerer and a two-agent answer-then-edit workflow. In each, a user submits a question through Streamlit; the app includes recent chat history, builds a CrewAI task and crew, and displays and stores the result. The multi-agent app also retains the first answer for comparison. Both configure CrewAI to use a local Ollama model. Workflow details are evidenced by the app excerpts; the README documents the Ollama connection.

Main entry points: [`single_agent/app.py`](https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py) (Chat and history), [`multi_agent/app.py`](https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py) (Chat and history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_single["Single-agent app"]
  node_single_chat["Chat and history<br/>[app.py]"]
  node_single_model["Model config<br/>[app.py]"]
  node_single_task["Answer task<br/>[app.py]"]
  node_single_crew["Answer crew<br/>[app.py]"]
end

subgraph group_multi["Multi-agent app"]
  node_multi_chat["Chat and history<br/>[app.py]"]
  node_multi_model["Model config<br/>[app.py]"]
  node_answer_task["Answer task<br/>[app.py]"]
  node_edit_task["Edit task<br/>[app.py]"]
  node_multi_crew["Two-agent crew<br/>[app.py]"]
end

subgraph group_inference["Local inference"]
  node_ollama["Ollama server"]
end

node_user(("User"))

node_user -->|"asks"| node_single_chat
node_single_chat -->|"builds with history"| node_single_task
node_single_chat -->|"configures"| node_single_model
node_single_model -->|"provides LLM"| node_single_task
node_single_task -->|"assigns task"| node_single_crew
node_single_chat -->|"kicks off"| node_single_crew
node_single_crew -->|"uses local model"| node_ollama
node_single_crew -->|"returns answer"| node_single_chat
node_user -->|"asks"| node_multi_chat
node_multi_chat -->|"builds with history"| node_answer_task
node_multi_chat -->|"configures"| node_multi_model
node_multi_model -->|"provides LLM"| node_answer_task
node_multi_model -->|"provides LLM"| node_edit_task
node_answer_task -->|"provides context"| node_edit_task
node_answer_task -->|"assigns task"| node_multi_crew
node_edit_task -->|"assigns task"| node_multi_crew
node_multi_chat -->|"kicks off"| node_multi_crew
node_multi_crew -->|"uses local model"| node_ollama
node_multi_crew -->|"returns edited answer"| node_multi_chat

click node_single_chat "https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py"
click node_single_model "https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py"
click node_single_task "https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py"
click node_single_crew "https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py"
click node_multi_chat "https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py"
click node_multi_model "https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py"
click node_answer_task "https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py"
click node_edit_task "https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py"
click node_multi_crew "https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.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_single_chat,node_single_model,node_single_task,node_single_crew,node_user toneBlue
class node_multi_chat,node_multi_model,node_answer_task,node_edit_task,node_multi_crew toneAmber
class node_ollama toneMint
```

## Components

### Single-agent app

- [Chat and history](https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py): `single_agent/app.py`
- [Model config](https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py): `single_agent/app.py`
- [Answer task](https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py): `single_agent/app.py`
- [Answer crew](https://github.com/thirumurugan240/local_ai_agent/blob/main/single_agent/app.py): `single_agent/app.py`

### Multi-agent app

- [Chat and history](https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py): `multi_agent/app.py`
- [Model config](https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py): `multi_agent/app.py`
- [Answer task](https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py): `multi_agent/app.py`
- [Edit task](https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py): `multi_agent/app.py`
- [Two-agent crew](https://github.com/thirumurugan240/local_ai_agent/blob/main/multi_agent/app.py): `multi_agent/app.py`

### Local inference

- **Ollama server**

### Other components

- **User**

## Connections

- User → Chat and history: asks (evidence: `single_agent/app.py`)
- Chat and history → Answer task: builds with history (evidence: `single_agent/app.py`)
- Chat and history → Model config: configures (evidence: `single_agent/app.py`)
- Model config → Answer task: provides LLM (evidence: `single_agent/app.py`)
- Answer task → Answer crew: assigns task (evidence: `single_agent/app.py`)
- Chat and history → Answer crew: kicks off (evidence: `single_agent/app.py`)
- Answer crew → Ollama server: uses local model (evidence: `README.md`)
- Answer crew → Chat and history: returns answer (evidence: `single_agent/app.py`)
- User → Chat and history: asks (evidence: `multi_agent/app.py`)
- Chat and history → Answer task: builds with history (evidence: `multi_agent/app.py`)
- Chat and history → Model config: configures (evidence: `multi_agent/app.py`)
- Model config → Answer task: provides LLM (evidence: `multi_agent/app.py`)
- Model config → Edit task: provides LLM (evidence: `multi_agent/app.py`)
- Answer task → Edit task: provides context (evidence: `multi_agent/app.py`)
- Answer task → Two-agent crew: assigns task (evidence: `multi_agent/app.py`)
- Edit task → Two-agent crew: assigns task (evidence: `multi_agent/app.py`)
- Chat and history → Two-agent crew: kicks off (evidence: `multi_agent/app.py`)
- Two-agent crew → Ollama server: uses local model (evidence: `README.md`)
- Two-agent crew → Chat and history: returns edited answer (evidence: `multi_agent/app.py`)
