# bhatti/agentic-ai-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/bhatti/agentic-ai-tutorial
- Repository: https://github.com/bhatti/agentic-ai-tutorial

## Overview

This repository is an educational financial-analysis agent application demonstrating local-model ReAct, RAG, tools, and workflow orchestration. Users submit questions or tickers through the Streamlit interface or CLI; the complete analysis workflow combines market, technical, sentiment, retrieval, and reasoning results into a report. The README documents these capabilities, while excerpts show selected component calls and workflow routing; unsampled implementation details are not inferred.

Main entry points: [`src/workflow.py`](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py) (Analysis Workflow), [`src/react_agent.py`](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/react_agent.py) (ReAct Reasoning), [`src/rag_engine.py`](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/rag_engine.py) (RAG Engine), [`src/main.py`](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/main.py) (Web App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_web_app["Web App<br/>[main.py]"]
  node_cli["CLI<br/>[cli.py]"]
end

subgraph group_agent_patterns["Agent Patterns"]
  node_react["ReAct Reasoning<br/>[react_agent.py]"]
  node_rag["RAG Engine<br/>[rag_engine.py]"]
  node_tool_registry["Tool Registry<br/>[tool_system.py]"]
  node_financial_tools["Financial Tools<br/>[tool_system.py]"]
end

subgraph group_analysis["Financial Analysis"]
  node_workflow["Analysis Workflow<br/>[workflow.py]"]
  node_market["Market Data<br/>[workflow.py]"]
  node_technical["Technical Analysis<br/>[workflow.py]"]
  node_sentiment["Sentiment Analysis<br/>[workflow.py]"]
  node_report["Analysis Report<br/>[workflow.py]"]
end

subgraph group_foundation["Model and Data Foundation"]
  node_config["Ollama Config<br/>[config.py]"]
  node_vector_store[("Vector Store<br/>[rag_engine.py]")]
end

node_user(("User"))
node_ollama["Ollama Service"]
node_market_service["Market Data Service"]

node_user -->|"submits analysis"| node_web_app
node_user -->|"submits command"| node_cli
node_web_app -->|"runs analysis"| node_workflow
node_cli -->|"runs analysis"| node_workflow
node_web_app -->|"retrieves and generates"| node_rag
node_workflow -->|"loads data"| node_market
node_workflow -.->|"analyzes indicators"| node_technical
node_workflow -.->|"analyzes sentiment"| node_sentiment
node_workflow -.->|"retrieves context"| node_rag
node_workflow -->|"reasons on analysis"| node_react
node_workflow -.->|"uses tools"| node_tool_registry
node_workflow -->|"generates report"| node_report
node_technical -->|"feeds reasoning"| node_react
node_sentiment -->|"feeds reasoning"| node_react
node_rag -->|"feeds reasoning"| node_react
node_rag -->|"stores and retrieves"| node_vector_store
node_tool_registry -->|"dispatches tools"| node_financial_tools
node_market -.->|"fetches quotes"| node_market_service
node_react -.->|"requests inference"| node_ollama
node_rag -.->|"embeds and generates"| node_ollama
node_workflow -.->|"generates analysis"| node_ollama
node_web_app -->|"loads settings"| node_config
node_workflow -->|"loads settings"| node_config
node_react -->|"loads settings"| node_config

click node_web_app "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/main.py"
click node_cli "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/cli.py"
click node_config "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/config.py"
click node_workflow "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py"
click node_market "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py"
click node_technical "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py"
click node_sentiment "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py"
click node_react "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/react_agent.py"
click node_rag "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/rag_engine.py"
click node_vector_store "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/rag_engine.py"
click node_tool_registry "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/tool_system.py"
click node_financial_tools "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/tool_system.py"
click node_report "https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.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_web_app,node_cli,node_user toneBlue
class node_react,node_rag,node_tool_registry,node_financial_tools toneAmber
class node_workflow,node_market,node_technical,node_sentiment,node_report toneMint
class node_config,node_vector_store toneRose
class node_ollama,node_market_service toneIndigo
```

## Components

### User Interfaces

- [Web App](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/main.py): `src/main.py`
- [CLI](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/cli.py): `src/cli.py`

### Agent Patterns

- [ReAct Reasoning](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/react_agent.py): `src/react_agent.py`
- [RAG Engine](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/rag_engine.py): `src/rag_engine.py`
- [Tool Registry](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/tool_system.py): `src/tool_system.py`
- [Financial Tools](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/tool_system.py): `src/tool_system.py`

### Financial Analysis

- [Analysis Workflow](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py): `src/workflow.py`
- [Market Data](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py): `src/workflow.py`
- [Technical Analysis](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py): `src/workflow.py`
- [Sentiment Analysis](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py): `src/workflow.py`
- [Analysis Report](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/workflow.py): `src/workflow.py`

### Model and Data Foundation

- [Ollama Config](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/config.py): `src/config.py`
- [Vector Store](https://github.com/bhatti/agentic-ai-tutorial/blob/main/src/rag_engine.py): `src/rag_engine.py`

### Other components

- **User**
- **Ollama Service**
- **Market Data Service**

## Connections

- User → Web App: submits analysis (evidence: `README.md`)
- User → CLI: submits command (evidence: `README.md`)
- Web App → Analysis Workflow: runs analysis (evidence: `README.md`)
- CLI → Analysis Workflow: runs analysis (evidence: `src/cli.py`)
- Web App → RAG Engine: retrieves and generates (evidence: `src/main.py`)
- Analysis Workflow → Market Data: loads data (evidence: `src/workflow.py`)
- Analysis Workflow → Technical Analysis: analyzes indicators (evidence: `src/workflow.py`)
- Analysis Workflow → Sentiment Analysis: analyzes sentiment (evidence: `src/workflow.py`)
- Analysis Workflow → RAG Engine: retrieves context (evidence: `src/workflow.py`)
- Analysis Workflow → ReAct Reasoning: reasons on analysis (evidence: `src/workflow.py`)
- Analysis Workflow → Tool Registry: uses tools (evidence: `src/workflow.py`)
- Analysis Workflow → Analysis Report: generates report (evidence: `src/workflow.py`)
- Technical Analysis → ReAct Reasoning: feeds reasoning (evidence: `src/workflow.py`)
- Sentiment Analysis → ReAct Reasoning: feeds reasoning (evidence: `src/workflow.py`)
- RAG Engine → ReAct Reasoning: feeds reasoning (evidence: `src/workflow.py`)
- RAG Engine → Vector Store: stores and retrieves (evidence: `README.md`)
- Tool Registry → Financial Tools: dispatches tools (evidence: `src/tool_system.py`)
- Market Data → Market Data Service: fetches quotes
- ReAct Reasoning → Ollama Service: requests inference
- RAG Engine → Ollama Service: embeds and generates
- Analysis Workflow → Ollama Service: generates analysis
- Web App → Ollama Config: loads settings (evidence: `src/main.py`)
- Analysis Workflow → Ollama Config: loads settings (evidence: `src/workflow.py`)
- ReAct Reasoning → Ollama Config: loads settings (evidence: `src/react_agent.py`)
