# ibm/vakra architecture

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

- Interactive diagram: https://gitdiagram.com/ibm/vakra
- Repository: https://github.com/ibm/vakra

## Overview

VAKRA is an executable benchmark for multi-step agent tool use across structured APIs and retrieved documents. The principal workflow runs benchmark items through an agent, exposes domain tools through MCP, and records trajectories for evaluation; separate evaluation components judge and score those traces. The README also describes API-style and multi-turn capabilities. Sampled source confirms the runner, agent, server, and evaluator structure, but not every runtime connection—unverified links are dashed.

Main entry points: [`benchmark_runner.py`](https://github.com/ibm/vakra/blob/main/benchmark_runner.py) (Benchmark Runner), [`evaluator/evaluator.py`](https://github.com/ibm/vakra/blob/main/evaluator/evaluator.py) (Trajectory Evaluator), [`agents/agent_interface.py`](https://github.com/ibm/vakra/blob/main/agents/agent_interface.py) (Agent Interface), [`environment/m3/python_tools/mcp/mcp_server.py`](https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/mcp/mcp_server.py) (Slot-Filling Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Benchmark Runs"]
  node_runner["Benchmark Runner"]
  node_mcpclient["MCP Tool Client"]
end

subgraph group_agent["Agent Reasoning"]
  node_agent["Agent Interface<br/>[agent_interface.py]"]
  node_shortlist["Tool Shortlisting"]
  node_llm["LLM Adapter<br/>[llm.py]"]
end

subgraph group_api["API Environment"]
  node_mcpserver["Slot-Filling Server<br/>[mcp_server.py]"]
  node_registry["Tool Registry<br/>[tool_registry.py]"]
  node_models["Tool Models<br/>[pydantic_models.py]"]
  node_slottools["Slot-Filling Tools"]
  node_restapp["REST API Host<br/>[app.py]"]
  node_domainapis["Domain API Routes"]
  node_bposerver["BPO Tool Server<br/>[server.py]"]
  node_bpoapis["BPO API Functions"]
  node_candidate_data[("Candidate Data<br/>[data_loader.py]")]
end

subgraph group_rag["Document Retrieval"]
  node_retrieval_server["Retrieval Service<br/>[server.py]"]
  node_retriever["Chroma Retriever"]
end

subgraph group_eval["Trajectory Evaluation"]
  node_evaluator["Trajectory Evaluator<br/>[evaluator.py]"]
  node_toolreplay["Tool Replay<br/>[mcp_tools.py]"]
  node_judge["Answer Judge<br/>[judge.py]"]
  node_scorer["Trajectory Scorer<br/>[scorer.py]"]
end

node_engineer(("Benchmark User"))

node_engineer -.->|"starts run"| node_runner
node_runner -->|"runs agent"| node_agent
node_runner -->|"connects tools"| node_mcpclient
node_runner -->|"launches server"| node_mcpserver
node_agent -->|"uses shortlist"| node_shortlist
node_agent -->|"calls model"| node_llm
node_mcpserver -->|"registers tools"| node_registry
node_mcpserver -->|"uses schemas"| node_models
node_registry -->|"registers tools"| node_slottools
node_restapp -->|"mounts routes"| node_domainapis
node_bposerver -->|"dispatches calls"| node_bpoapis
node_bpoapis -->|"loads records"| node_candidate_data
node_retrieval_server -->|"uses retriever"| node_retriever
node_runner -.->|"uses retrieval"| node_retrieval_server
node_evaluator -->|"replays tools"| node_toolreplay
node_evaluator -->|"requests judgment"| node_judge
node_evaluator -->|"scores traces"| node_scorer
node_toolreplay -.->|"uses MCP"| node_mcpclient

click node_runner "https://github.com/ibm/vakra/blob/main/benchmark_runner.py"
click node_agent "https://github.com/ibm/vakra/blob/main/agents/agent_interface.py"
click node_shortlist "https://github.com/ibm/vakra/blob/main/agents/components/tool_shortlister.py"
click node_llm "https://github.com/ibm/vakra/blob/main/agents/llm.py"
click node_mcpclient "https://github.com/ibm/vakra/blob/main/agents/mcp_tool_wrapper.py"
click node_mcpserver "https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/mcp/mcp_server.py"
click node_registry "https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/tools/tool_registry.py"
click node_models "https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/tools/pydantic_models.py"
click node_slottools "https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/tools/slot_filling_tools.py"
click node_restapp "https://github.com/ibm/vakra/blob/main/environment/m3/rest/app.py"
click node_domainapis "https://github.com/ibm/vakra/tree/main/environment/m3/rest/server"
click node_bposerver "https://github.com/ibm/vakra/blob/main/environment/bpo/mcp/server.py"
click node_bpoapis "https://github.com/ibm/vakra/tree/main/environment/bpo/api"
click node_candidate_data "https://github.com/ibm/vakra/blob/main/environment/bpo/api/data_loader.py"
click node_retrieval_server "https://github.com/ibm/vakra/blob/main/environment/retrievers/server.py"
click node_retriever "https://github.com/ibm/vakra/blob/main/environment/retrievers/chromadb_retriever.py"
click node_evaluator "https://github.com/ibm/vakra/blob/main/evaluator/evaluator.py"
click node_toolreplay "https://github.com/ibm/vakra/blob/main/evaluator/mcp_tools.py"
click node_judge "https://github.com/ibm/vakra/blob/main/evaluator/judge.py"
click node_scorer "https://github.com/ibm/vakra/blob/main/evaluator/scorer.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_runner,node_mcpclient,node_engineer toneBlue
class node_agent,node_shortlist,node_llm toneAmber
class node_mcpserver,node_registry,node_models,node_slottools,node_restapp,node_domainapis,node_bposerver,node_bpoapis,node_candidate_data toneMint
class node_retrieval_server,node_retriever toneRose
class node_evaluator,node_toolreplay,node_judge,node_scorer toneIndigo
```

## Components

### Benchmark Runs

- [Benchmark Runner](https://github.com/ibm/vakra/blob/main/benchmark_runner.py): `benchmark_runner.py`
- [MCP Tool Client](https://github.com/ibm/vakra/blob/main/agents/mcp_tool_wrapper.py): `agents/mcp_tool_wrapper.py`

### Agent Reasoning

- [Agent Interface](https://github.com/ibm/vakra/blob/main/agents/agent_interface.py): `agents/agent_interface.py`
- [Tool Shortlisting](https://github.com/ibm/vakra/blob/main/agents/components/tool_shortlister.py): `agents/components/tool_shortlister.py`
- [LLM Adapter](https://github.com/ibm/vakra/blob/main/agents/llm.py): `agents/llm.py`

### API Environment

- [Slot-Filling Server](https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/mcp/mcp_server.py): `environment/m3/python_tools/mcp/mcp_server.py`
- [Tool Registry](https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/tools/tool_registry.py): `environment/m3/python_tools/tools/tool_registry.py`
- [Tool Models](https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/tools/pydantic_models.py): `environment/m3/python_tools/tools/pydantic_models.py`
- [Slot-Filling Tools](https://github.com/ibm/vakra/blob/main/environment/m3/python_tools/tools/slot_filling_tools.py): `environment/m3/python_tools/tools/slot_filling_tools.py`
- [REST API Host](https://github.com/ibm/vakra/blob/main/environment/m3/rest/app.py): `environment/m3/rest/app.py`
- [Domain API Routes](https://github.com/ibm/vakra/tree/main/environment/m3/rest/server): `environment/m3/rest/server`
- [BPO Tool Server](https://github.com/ibm/vakra/blob/main/environment/bpo/mcp/server.py): `environment/bpo/mcp/server.py`
- [BPO API Functions](https://github.com/ibm/vakra/tree/main/environment/bpo/api): `environment/bpo/api`
- [Candidate Data](https://github.com/ibm/vakra/blob/main/environment/bpo/api/data_loader.py): `environment/bpo/api/data_loader.py`

### Document Retrieval

- [Retrieval Service](https://github.com/ibm/vakra/blob/main/environment/retrievers/server.py): `environment/retrievers/server.py`
- [Chroma Retriever](https://github.com/ibm/vakra/blob/main/environment/retrievers/chromadb_retriever.py): `environment/retrievers/chromadb_retriever.py`

### Trajectory Evaluation

- [Trajectory Evaluator](https://github.com/ibm/vakra/blob/main/evaluator/evaluator.py): `evaluator/evaluator.py`
- [Tool Replay](https://github.com/ibm/vakra/blob/main/evaluator/mcp_tools.py): `evaluator/mcp_tools.py`
- [Answer Judge](https://github.com/ibm/vakra/blob/main/evaluator/judge.py): `evaluator/judge.py`
- [Trajectory Scorer](https://github.com/ibm/vakra/blob/main/evaluator/scorer.py): `evaluator/scorer.py`

### Other components

- **Benchmark User**

## Connections

- Benchmark User → Benchmark Runner: starts run
- Benchmark Runner → Agent Interface: runs agent (evidence: `benchmark_runner.py`)
- Benchmark Runner → MCP Tool Client: connects tools (evidence: `benchmark_runner.py`)
- Benchmark Runner → Slot-Filling Server: launches server (evidence: `benchmark_runner.py`)
- Agent Interface → Tool Shortlisting: uses shortlist (evidence: `agents/agent_interface.py`)
- Agent Interface → LLM Adapter: calls model (evidence: `agents/agent_interface.py`)
- Slot-Filling Server → Tool Registry: registers tools (evidence: `environment/m3/python_tools/mcp/mcp_server.py`)
- Slot-Filling Server → Tool Models: uses schemas (evidence: `environment/m3/python_tools/mcp/mcp_server.py`)
- Tool Registry → Slot-Filling Tools: registers tools (evidence: `environment/m3/python_tools/tools/tool_registry.py`)
- REST API Host → Domain API Routes: mounts routes (evidence: `environment/m3/rest/app.py`)
- BPO Tool Server → BPO API Functions: dispatches calls (evidence: `environment/bpo/mcp/server.py`)
- BPO API Functions → Candidate Data: loads records (evidence: `environment/bpo/api/data_loader.py`)
- Retrieval Service → Chroma Retriever: uses retriever (evidence: `environment/retrievers/server.py`)
- Benchmark Runner → Retrieval Service: uses retrieval
- Trajectory Evaluator → Tool Replay: replays tools (evidence: `evaluator/evaluator.py`)
- Trajectory Evaluator → Answer Judge: requests judgment (evidence: `evaluator/evaluator.py`)
- Trajectory Evaluator → Trajectory Scorer: scores traces (evidence: `evaluator/evaluator.py`)
- Tool Replay → MCP Tool Client: uses MCP
