# quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp architecture

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

- Interactive diagram: https://gitdiagram.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp
- Repository: https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp

## Overview

This is a small research-agent lab: a user submits a research request, a model selects declared tools, the agent executes them and returns results; interactive sessions can pause for clarification and save transcripts. A Streamlit demo wraps that runtime, while a separate evaluator measures tool routing and arguments against datasets and writes run records. The README also describes prompt/tool iteration and version tracking. The graph preserves the documented research capabilities; edges involving unsampled evaluator or demo internals rely on the README or SOURCE INDEX, so implementation details there are intentionally limited.

Main entry points: [`starter_v0/tools/__init__.py`](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/__init__.py) (Tool Registry), [`starter_v0/chat.py`](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/chat.py) (Interactive Chat), [`starter_v0/run_eval.py`](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/run_eval.py) (Eval Runner), [`starter_v0/agent.py`](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/agent.py) (Tool Agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User Interaction"]
  node_webui["Streamlit UI<br/>[app.py]"]
  node_demo["Demo Runtime<br/>[demo_runtime.py]"]
end

subgraph group_runtime["Agent Runtime"]
  node_chat["Interactive Chat<br/>[chat.py]"]
  node_agent["Tool Agent<br/>[agent.py]"]
  node_registry["Tool Registry<br/>[__init__.py]"]
  node_providers["Provider Adapters<br/>[__init__.py]"]
  node_env["Environment Loader<br/>[env_loader.py]"]
end

subgraph group_research["Research Tools"]
  node_social["Social Search<br/>[tool.py]"]
  node_webresearch["Web Lookup &amp; Fetch<br/>[tool.py]"]
  node_timeline["Account Timeline<br/>[tool.py]"]
  node_papers["Paper Search<br/>[tool.py]"]
  node_papertext["Paper Text<br/>[tool.py]"]
  node_policy["Policy Search<br/>[tool.py]"]
  node_clarify["Clarification<br/>[tool.py]"]
  node_digest["Digest &amp; Export<br/>[tool.py]"]
end

subgraph group_evaluation["Evaluation Loop"]
  node_eval["Eval Runner<br/>[run_eval.py]"]
  node_datasets["Eval Cases<br/>[eval_base.json]"]
  node_runs["Run Records"]
  node_versioning["Artifact Versioning<br/>[versioning.py]"]
end

node_user(("Researcher"))
node_model(("Model API"))

node_user -->|"submits request"| node_webui
node_webui -->|"uses runtime"| node_demo
node_demo -->|"delegates chat"| node_chat
node_user -->|"enters request"| node_chat
node_chat -->|"selects provider"| node_providers
node_providers -->|"requests completion"| node_model
node_chat -->|"loads tools"| node_registry
node_chat -->|"runs tool loop"| node_agent
node_agent -->|"requests completion"| node_providers
node_agent -->|"dispatches calls"| node_registry
node_registry -->|"registers"| node_social
node_registry -->|"registers"| node_webresearch
node_registry -->|"registers"| node_timeline
node_registry -->|"registers"| node_papers
node_registry -->|"registers"| node_papertext
node_registry -->|"registers"| node_policy
node_registry -->|"registers"| node_clarify
node_registry -->|"registers"| node_digest
node_eval -->|"evaluates calls"| node_agent
node_eval -->|"loads cases"| node_datasets
node_eval -->|"selects provider"| node_providers
node_eval -->|"loads declarations"| node_registry
node_eval -->|"writes results"| node_runs
node_eval -->|"hashes artifacts"| node_versioning
node_chat -->|"hashes artifacts"| node_versioning
node_chat -->|"loads environment"| node_env

click node_webui "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/app.py"
click node_demo "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/demo_runtime.py"
click node_chat "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/chat.py"
click node_agent "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/agent.py"
click node_registry "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/__init__.py"
click node_providers "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/providers/__init__.py"
click node_social "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/social_search/tool.py"
click node_webresearch "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/lookup/tool.py"
click node_timeline "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/timeline/tool.py"
click node_papers "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/papers/tool.py"
click node_papertext "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/paper_text/tool.py"
click node_policy "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/policy/tool.py"
click node_clarify "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/clarify/tool.py"
click node_digest "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/export_digest/tool.py"
click node_eval "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/run_eval.py"
click node_datasets "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/data/eval_base.json"
click node_runs "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/tree/main/starter_v0/runs"
click node_versioning "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/versioning.py"
click node_env "https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/env_loader.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_webui,node_demo toneBlue
class node_chat,node_agent,node_registry,node_providers,node_env toneAmber
class node_social,node_webresearch,node_timeline,node_papers,node_papertext,node_policy,node_clarify,node_digest,node_model toneMint
class node_eval,node_datasets,node_runs,node_versioning toneRose
class node_user toneIndigo
```

## Components

### User Interaction

- [Streamlit UI](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/app.py): `starter_v0/app.py`
- [Demo Runtime](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/demo_runtime.py): `starter_v0/demo_runtime.py`

### Agent Runtime

- [Interactive Chat](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/chat.py): `starter_v0/chat.py`
- [Tool Agent](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/agent.py): `starter_v0/agent.py`
- [Tool Registry](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/__init__.py): `starter_v0/tools/__init__.py`
- [Provider Adapters](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/providers/__init__.py): `starter_v0/providers/__init__.py`
- [Environment Loader](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/env_loader.py): `starter_v0/env_loader.py`

### Research Tools

- [Social Search](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/social_search/tool.py): `starter_v0/tools/social_search/tool.py`
- [Web Lookup & Fetch](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/lookup/tool.py): `starter_v0/tools/lookup/tool.py`
- [Account Timeline](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/timeline/tool.py): `starter_v0/tools/timeline/tool.py`
- [Paper Search](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/papers/tool.py): `starter_v0/tools/papers/tool.py`
- [Paper Text](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/paper_text/tool.py): `starter_v0/tools/paper_text/tool.py`
- [Policy Search](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/policy/tool.py): `starter_v0/tools/policy/tool.py`
- [Clarification](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/clarify/tool.py): `starter_v0/tools/clarify/tool.py`
- [Digest & Export](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/tools/export_digest/tool.py): `starter_v0/tools/export_digest/tool.py`

### Evaluation Loop

- [Eval Runner](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/run_eval.py): `starter_v0/run_eval.py`
- [Eval Cases](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/data/eval_base.json): `starter_v0/data/eval_base.json`
- [Run Records](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/tree/main/starter_v0/runs): `starter_v0/runs`
- [Artifact Versioning](https://github.com/quocanhtapcode/k5-l3a-day03-problemsolver-promptfunctioncallingtooldesignmcp/blob/main/starter_v0/versioning.py): `starter_v0/versioning.py`

### Other components

- **Researcher**
- **Model API**

## Connections

- Researcher → Streamlit UI: submits request (evidence: `README.md`)
- Streamlit UI → Demo Runtime: uses runtime (evidence: `starter_v0/app.py`)
- Demo Runtime → Interactive Chat: delegates chat (evidence: `starter_v0/demo_runtime.py`)
- Researcher → Interactive Chat: enters request (evidence: `README.md`)
- Interactive Chat → Provider Adapters: selects provider (evidence: `starter_v0/chat.py`)
- Provider Adapters → Model API: requests completion
- Interactive Chat → Tool Registry: loads tools (evidence: `starter_v0/chat.py`)
- Interactive Chat → Tool Agent: runs tool loop (evidence: `starter_v0/agent.py`)
- Tool Agent → Provider Adapters: requests completion (evidence: `starter_v0/agent.py`)
- Tool Agent → Tool Registry: dispatches calls (evidence: `starter_v0/agent.py`)
- Tool Registry → Social Search: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Web Lookup & Fetch: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Account Timeline: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Paper Search: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Paper Text: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Policy Search: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Clarification: registers (evidence: `starter_v0/tools/__init__.py`)
- Tool Registry → Digest & Export: registers (evidence: `starter_v0/tools/__init__.py`)
- Eval Runner → Tool Agent: evaluates calls (evidence: `starter_v0/run_eval.py`)
- Eval Runner → Eval Cases: loads cases (evidence: `README.md`)
- Eval Runner → Provider Adapters: selects provider (evidence: `starter_v0/run_eval.py`)
- Eval Runner → Tool Registry: loads declarations (evidence: `starter_v0/run_eval.py`)
- Eval Runner → Run Records: writes results (evidence: `README.md`)
- Eval Runner → Artifact Versioning: hashes artifacts (evidence: `starter_v0/run_eval.py`)
- Interactive Chat → Artifact Versioning: hashes artifacts (evidence: `starter_v0/chat.py`)
- Interactive Chat → Environment Loader: loads environment (evidence: `starter_v0/chat.py`)
