# shahzaibkaramat67-coder/sdk_correction_agent architecture

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

- Interactive diagram: https://gitdiagram.com/shahzaibkaramat67-coder/sdk_correction_agent
- Repository: https://github.com/shahzaibkaramat67-coder/sdk_correction_agent

## Overview

This is a command-line research assistant: a user submits questions, the agent asks a language model whether to answer directly or invoke search/research, and the final response is printed and retained in conversation memory. Search gathers web-result metadata; research fetches and extracts page text from those sources. The map includes the documented tool-schema branch and the separate search and research capabilities. Source excerpts show the main calls; external service relationships are limited to integrations visible in code.

Main entry points: [`run_Agent.py`](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/run_Agent.py) (Agent loop), [`model.py`](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/model.py) (Model client), [`enterpoint.py`](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/enterpoint.py) (Conversation loop), [`memory.py`](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/memory.py) (Conversation memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_launcher["CLI launcher<br/>[main.py]"]
  node_conversation["Conversation loop<br/>[enterpoint.py]"]
end

subgraph group_agent["Agent and memory"]
  node_agent_loop["Agent loop<br/>[run_Agent.py]"]
  node_memory["Conversation memory<br/>[memory.py]"]
  node_model["Model client<br/>[model.py]"]
end

subgraph group_research["Model and research tools"]
  node_tool_schema["Tool schema access<br/>[too_schema.py]"]
  node_registry["Tool definitions<br/>[TOOL_REGISTRY.py]"]
  node_search["Web search<br/>[Tools.py]"]
  node_research_tool["Source research<br/>[Tools.py]"]
  node_fetch["Page extraction<br/>[Tools.py]"]
end

node_user(("User"))
node_llm_service["OpenAI-compatible API"]
node_search_service["DuckDuckGo search"]
node_web["Web pages"]

node_user -->|"submits question"| node_conversation
node_launcher -->|"starts"| node_conversation
node_conversation -->|"records messages"| node_memory
node_conversation -->|"calls"| node_agent_loop
node_agent_loop -->|"requests completion"| node_model
node_agent_loop -->|"reads and updates"| node_memory
node_model -->|"reads history"| node_memory
node_model -->|"gets tool definitions"| node_tool_schema
node_tool_schema -->|"imports definitions"| node_registry
node_model -->|"sends completion request"| node_llm_service
node_agent_loop -->|"dispatches search"| node_search
node_agent_loop -->|"dispatches research"| node_research_tool
node_search -->|"queries"| node_search_service
node_research_tool -->|"reads source results"| node_memory
node_research_tool -->|"fetches source pages"| node_fetch
node_fetch -->|"requests page content"| node_web

click node_launcher "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/main.py"
click node_conversation "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/enterpoint.py"
click node_agent_loop "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/run_Agent.py"
click node_memory "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/memory.py"
click node_model "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/model.py"
click node_tool_schema "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/too_schema.py"
click node_registry "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/TOOL_REGISTRY.py"
click node_search "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/Tools.py"
click node_research_tool "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/Tools.py"
click node_fetch "https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/Tools.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_launcher,node_conversation,node_user toneBlue
class node_agent_loop,node_memory,node_model toneAmber
class node_tool_schema,node_registry,node_search,node_research_tool,node_fetch,node_llm_service toneMint
class node_search_service,node_web toneIndigo
```

## Components

### Interaction

- [CLI launcher](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/main.py): `main.py`
- [Conversation loop](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/enterpoint.py): `enterpoint.py`

### Agent and memory

- [Agent loop](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/run_Agent.py): `run_Agent.py`
- [Conversation memory](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/memory.py): `memory.py`
- [Model client](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/model.py): `model.py`

### Model and research tools

- [Tool schema access](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/too_schema.py): `too_schema.py`
- [Tool definitions](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/TOOL_REGISTRY.py): `TOOL_REGISTRY.py`
- [Web search](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/Tools.py): `Tools.py`
- [Source research](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/Tools.py): `Tools.py`
- [Page extraction](https://github.com/shahzaibkaramat67-coder/sdk_correction_agent/blob/main/Tools.py): `Tools.py`

### Other components

- **User**
- **OpenAI-compatible API**
- **DuckDuckGo search**
- **Web pages**

## Connections

- User → Conversation loop: submits question (evidence: `enterpoint.py`)
- CLI launcher → Conversation loop: starts (evidence: `main.py`)
- Conversation loop → Conversation memory: records messages (evidence: `enterpoint.py`)
- Conversation loop → Agent loop: calls (evidence: `enterpoint.py`)
- Agent loop → Model client: requests completion (evidence: `run_Agent.py`)
- Agent loop → Conversation memory: reads and updates (evidence: `run_Agent.py`)
- Model client → Conversation memory: reads history (evidence: `model.py`)
- Model client → Tool schema access: gets tool definitions (evidence: `model.py`)
- Tool schema access → Tool definitions: imports definitions (evidence: `too_schema.py`)
- Model client → OpenAI-compatible API: sends completion request (evidence: `model.py`)
- Agent loop → Web search: dispatches search (evidence: `run_Agent.py`)
- Agent loop → Source research: dispatches research (evidence: `run_Agent.py`)
- Web search → DuckDuckGo search: queries (evidence: `Tools.py`)
- Source research → Conversation memory: reads source results (evidence: `run_Agent.py`)
- Source research → Page extraction: fetches source pages (evidence: `Tools.py`)
- Page extraction → Web pages: requests page content (evidence: `Tools.py`)
