# aryan-04-stack/coding_agent architecture

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

- Interactive diagram: https://gitdiagram.com/aryan-04-stack/coding_agent
- Repository: https://github.com/aryan-04-stack/coding_agent

## Overview

This is a command-line AI coding agent. A user supplies a task; the agent sends it to Gemini with tool declarations, dispatches requested tools, returns their results to Gemini, and prints the final response. The tools inspect directories, read and write files within a working directory, and execute Python files. The graph reflects the documented agent loop and the sampled calls; it does not expand into the contents of the workspace or claim details about unsampled behavior.

Main entry points: [`bot_v2.py`](https://github.com/aryan-04-stack/coding_agent/blob/main/bot_v2.py) (Agent loop), [`functions/call_function.py`](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/call_function.py) (Function dispatcher), [`functions/files_data.py`](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/files_data.py) (Read files), [`functions/run_python.py`](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/run_python.py) (Run Python)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent loop"]
  node_cli["Agent loop<br/>[bot_v2.py]"]
end

subgraph group_dispatch["Tool dispatch"]
  node_dispatcher["Function dispatcher<br/>[call_function.py]"]
end

subgraph group_tools["Workspace tools"]
  node_list["List files<br/>[files_info.py]"]
  node_read["Read files<br/>[files_data.py]"]
  node_write["Write files<br/>[write_file.py]"]
  node_execute["Run Python<br/>[run_python.py]"]
  node_limits["Read limit<br/>[config.py]"]
end

node_user(("User"))
node_gemini["Gemini API"]
node_workspace[("Working directory")]
node_python["Python interpreter"]

node_user -->|"provides task"| node_cli
node_cli -->|"sends prompt"| node_gemini
node_gemini -->|"returns tool calls"| node_cli
node_cli -->|"dispatches calls"| node_dispatcher
node_dispatcher -->|"calls listing"| node_list
node_dispatcher -->|"calls reader"| node_read
node_dispatcher -->|"calls writer"| node_write
node_dispatcher -->|"calls runner"| node_execute
node_read -->|"uses character limit"| node_limits
node_list -->|"lists contents"| node_workspace
node_read -->|"reads files"| node_workspace
node_write -->|"writes files"| node_workspace
node_execute -->|"runs workspace file"| node_workspace
node_execute -->|"launches process"| node_python
node_dispatcher -->|"returns tool result"| node_cli
node_cli -->|"returns tool result"| node_gemini
node_gemini -->|"returns final response"| node_cli
node_cli -->|"prints response"| node_user

click node_cli "https://github.com/aryan-04-stack/coding_agent/blob/main/bot_v2.py"
click node_dispatcher "https://github.com/aryan-04-stack/coding_agent/blob/main/functions/call_function.py"
click node_list "https://github.com/aryan-04-stack/coding_agent/blob/main/functions/files_info.py"
click node_read "https://github.com/aryan-04-stack/coding_agent/blob/main/functions/files_data.py"
click node_write "https://github.com/aryan-04-stack/coding_agent/blob/main/functions/write_file.py"
click node_execute "https://github.com/aryan-04-stack/coding_agent/blob/main/functions/run_python.py"
click node_limits "https://github.com/aryan-04-stack/coding_agent/blob/main/config.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_cli,node_user toneBlue
class node_dispatcher,node_workspace toneAmber
class node_list,node_read,node_write,node_execute,node_limits,node_gemini toneMint
class node_python toneIndigo
```

## Components

### Agent loop

- [Agent loop](https://github.com/aryan-04-stack/coding_agent/blob/main/bot_v2.py): `bot_v2.py`

### Tool dispatch

- [Function dispatcher](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/call_function.py): `functions/call_function.py`

### Workspace tools

- [List files](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/files_info.py): `functions/files_info.py`
- [Read files](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/files_data.py): `functions/files_data.py`
- [Write files](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/write_file.py): `functions/write_file.py`
- [Run Python](https://github.com/aryan-04-stack/coding_agent/blob/main/functions/run_python.py): `functions/run_python.py`
- [Read limit](https://github.com/aryan-04-stack/coding_agent/blob/main/config.py): `config.py`

### Other components

- **User**
- **Gemini API**
- **Working directory**
- **Python interpreter**

## Connections

- User → Agent loop: provides task (evidence: `bot_v2.py`)
- Agent loop → Gemini API: sends prompt (evidence: `bot_v2.py`)
- Gemini API → Agent loop: returns tool calls (evidence: `bot_v2.py`)
- Agent loop → Function dispatcher: dispatches calls (evidence: `bot_v2.py`)
- Function dispatcher → List files: calls listing (evidence: `functions/call_function.py`)
- Function dispatcher → Read files: calls reader (evidence: `functions/call_function.py`)
- Function dispatcher → Write files: calls writer (evidence: `functions/call_function.py`)
- Function dispatcher → Run Python: calls runner (evidence: `functions/call_function.py`)
- Read files → Read limit: uses character limit (evidence: `functions/files_data.py`)
- List files → Working directory: lists contents (evidence: `functions/files_info.py`)
- Read files → Working directory: reads files (evidence: `functions/files_data.py`)
- Write files → Working directory: writes files (evidence: `functions/write_file.py`)
- Run Python → Working directory: runs workspace file (evidence: `functions/run_python.py`)
- Run Python → Python interpreter: launches process (evidence: `functions/run_python.py`)
- Function dispatcher → Agent loop: returns tool result (evidence: `functions/call_function.py`)
- Agent loop → Gemini API: returns tool result (evidence: `bot_v2.py`)
- Gemini API → Agent loop: returns final response (evidence: `bot_v2.py`)
- Agent loop → User: prints response (evidence: `bot_v2.py`)
