# klodit-team/agents architecture

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

- Interactive diagram: https://gitdiagram.com/klodit-team/agents
- Repository: https://github.com/klodit-team/agents

## Overview

This repository is a set of five one-shot procurement AI agents, each launched with task-specific environment variables and coordinating MCP servers over stdio. The workflows cover document OCR/NLP validation, bid anomaly detection, submission scoring, CDC drafting, and direct-award compliance assessment. Agent scripts own the calls to domain services and audit logging; shared modules provide MCP connection lifecycle and tool-result parsing. The README documents the service capabilities, while sampled source shows concrete calls and data flow. Unsampled source was not inspected, so edges reflect only documented or excerpted relationships.

Main entry points: [`src/agents/gre-a-gre-agent.ts`](https://github.com/klodit-team/agents/blob/main/src/agents/gre-a-gre-agent.ts) (Direct-award agent), [`src/agents/ocr-nlp-agent.ts`](https://github.com/klodit-team/agents/blob/main/src/agents/ocr-nlp-agent.ts) (OCR/NLP agent), [`src/agents/evaluation-agent.ts`](https://github.com/klodit-team/agents/blob/main/src/agents/evaluation-agent.ts) (Evaluation agent), [`src/agents/anomaly-agent.ts`](https://github.com/klodit-team/agents/blob/main/src/agents/anomaly-agent.ts) (Anomaly agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["Agent workflows"]
  node_ocr["OCR/NLP agent<br/>[ocr-nlp-agent.ts]"]
  node_anomaly["Anomaly agent<br/>[anomaly-agent.ts]"]
  node_evaluation["Evaluation agent"]
  node_cdc["CDC drafting agent<br/>[genai-cdc-agent.ts]"]
  node_gre["Direct-award agent<br/>[gre-a-gre-agent.ts]"]
end

subgraph group_services["MCP services"]
  node_documents["Documents"]
  node_storage["Storage"]
  node_analysis["Document analysis"]
  node_nlp["NLP"]
  node_notifications["Notifications"]
  node_soumissions["Submissions"]
  node_anomalyservice["Anomaly detection"]
  node_evaluationservice["Evaluation"]
  node_llm["LLM"]
  node_ao["Tenders &#40;AO&#41;"]
  node_users["Users"]
  node_audit["Audit"]
end

subgraph group_shared["Shared runtime"]
  node_mcpclient["MCP connections<br/>[mcpClient.ts]"]
  node_tooling["Tool helpers<br/>[tooling.ts]"]
end

node_operator(("Operator"))

node_operator -->|"launches"| node_ocr
node_operator -->|"launches"| node_anomaly
node_operator -->|"launches"| node_evaluation
node_operator -->|"launches"| node_cdc
node_operator -->|"launches"| node_gre
node_ocr -->|"connects via"| node_mcpclient
node_ocr -->|"calls tools via"| node_tooling
node_anomaly -->|"connects via"| node_mcpclient
node_anomaly -->|"calls tools via"| node_tooling
node_evaluation -->|"connects via"| node_mcpclient
node_evaluation -->|"calls tools via"| node_tooling
node_cdc -->|"connects via"| node_mcpclient
node_cdc -->|"calls tools via"| node_tooling
node_gre -->|"connects via"| node_mcpclient
node_gre -->|"calls tools via"| node_tooling
node_ocr -->|"reads, writes"| node_documents
node_ocr -->|"gets URLs"| node_storage
node_ocr -->|"extracts text"| node_analysis
node_ocr -->|"checks fields"| node_nlp
node_ocr -->|"sends alerts"| node_notifications
node_ocr -->|"logs decision"| node_audit
node_anomaly -->|"reads, flags"| node_soumissions
node_anomaly -->|"detects patterns"| node_anomalyservice
node_anomaly -->|"records incidents"| node_audit
node_evaluation -->|"gets criteria, writes scores"| node_evaluationservice
node_evaluation -->|"reads offers"| node_soumissions
node_evaluation -->|"extracts offer text"| node_analysis
node_evaluation -->|"scores, aggregates"| node_llm
node_evaluation -->|"logs decision"| node_audit
node_cdc -->|"reads tender context"| node_ao
node_cdc -->|"drafts, checks bias"| node_llm
node_cdc -->|"logs decision"| node_audit
node_gre -->|"reads tender"| node_ao
node_gre -->|"reads profile"| node_users
node_gre -->|"gets document URLs"| node_documents
node_gre -->|"gets URLs"| node_storage
node_gre -->|"extracts text"| node_analysis
node_gre -->|"scores, classifies"| node_llm
node_gre -->|"writes assessment"| node_ao
node_gre -->|"logs decision"| node_audit

click node_ocr "https://github.com/klodit-team/agents/blob/main/src/agents/ocr-nlp-agent.ts"
click node_anomaly "https://github.com/klodit-team/agents/blob/main/src/agents/anomaly-agent.ts"
click node_evaluation "https://github.com/klodit-team/agents/blob/main/src/agents/evaluation-agent.ts"
click node_cdc "https://github.com/klodit-team/agents/blob/main/src/agents/genai-cdc-agent.ts"
click node_gre "https://github.com/klodit-team/agents/blob/main/src/agents/gre-a-gre-agent.ts"
click node_mcpclient "https://github.com/klodit-team/agents/blob/main/src/shared/mcpClient.ts"
click node_tooling "https://github.com/klodit-team/agents/blob/main/src/shared/tooling.ts"

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_ocr,node_anomaly,node_evaluation,node_cdc,node_gre toneBlue
class node_documents,node_storage,node_analysis,node_nlp,node_notifications,node_soumissions,node_anomalyservice,node_evaluationservice,node_llm,node_ao,node_users,node_audit toneAmber
class node_mcpclient,node_tooling toneMint
class node_operator toneIndigo
```

## Components

### Agent workflows

- [OCR/NLP agent](https://github.com/klodit-team/agents/blob/main/src/agents/ocr-nlp-agent.ts): `src/agents/ocr-nlp-agent.ts`
- [Anomaly agent](https://github.com/klodit-team/agents/blob/main/src/agents/anomaly-agent.ts): `src/agents/anomaly-agent.ts`
- [Evaluation agent](https://github.com/klodit-team/agents/blob/main/src/agents/evaluation-agent.ts): `src/agents/evaluation-agent.ts`
- [CDC drafting agent](https://github.com/klodit-team/agents/blob/main/src/agents/genai-cdc-agent.ts): `src/agents/genai-cdc-agent.ts`
- [Direct-award agent](https://github.com/klodit-team/agents/blob/main/src/agents/gre-a-gre-agent.ts): `src/agents/gre-a-gre-agent.ts`

### MCP services

- **Documents**
- **Storage**
- **Document analysis**
- **NLP**
- **Notifications**
- **Submissions**
- **Anomaly detection**
- **Evaluation**
- **LLM**
- **Tenders (AO)**
- **Users**
- **Audit**

### Shared runtime

- [MCP connections](https://github.com/klodit-team/agents/blob/main/src/shared/mcpClient.ts): `src/shared/mcpClient.ts`
- [Tool helpers](https://github.com/klodit-team/agents/blob/main/src/shared/tooling.ts): `src/shared/tooling.ts`

### Other components

- **Operator**

## Connections

- Operator → OCR/NLP agent: launches (evidence: `README.md`)
- Operator → Anomaly agent: launches (evidence: `README.md`)
- Operator → Evaluation agent: launches (evidence: `README.md`)
- Operator → CDC drafting agent: launches (evidence: `README.md`)
- Operator → Direct-award agent: launches (evidence: `README.md`)
- OCR/NLP agent → MCP connections: connects via (evidence: `src/agents/ocr-nlp-agent.ts`)
- OCR/NLP agent → Tool helpers: calls tools via (evidence: `src/agents/ocr-nlp-agent.ts`)
- Anomaly agent → MCP connections: connects via (evidence: `src/agents/anomaly-agent.ts`)
- Anomaly agent → Tool helpers: calls tools via (evidence: `src/agents/anomaly-agent.ts`)
- Evaluation agent → MCP connections: connects via (evidence: `src/agents/evaluation-agent.ts`)
- Evaluation agent → Tool helpers: calls tools via (evidence: `src/agents/evaluation-agent.ts`)
- CDC drafting agent → MCP connections: connects via (evidence: `src/agents/genai-cdc-agent.ts`)
- CDC drafting agent → Tool helpers: calls tools via (evidence: `src/agents/genai-cdc-agent.ts`)
- Direct-award agent → MCP connections: connects via (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Tool helpers: calls tools via (evidence: `src/agents/gre-a-gre-agent.ts`)
- OCR/NLP agent → Documents: reads, writes (evidence: `src/agents/ocr-nlp-agent.ts`)
- OCR/NLP agent → Storage: gets URLs (evidence: `src/agents/ocr-nlp-agent.ts`)
- OCR/NLP agent → Document analysis: extracts text (evidence: `src/agents/ocr-nlp-agent.ts`)
- OCR/NLP agent → NLP: checks fields (evidence: `src/agents/ocr-nlp-agent.ts`)
- OCR/NLP agent → Notifications: sends alerts (evidence: `src/agents/ocr-nlp-agent.ts`)
- OCR/NLP agent → Audit: logs decision (evidence: `src/agents/ocr-nlp-agent.ts`)
- Anomaly agent → Submissions: reads, flags (evidence: `src/agents/anomaly-agent.ts`)
- Anomaly agent → Anomaly detection: detects patterns (evidence: `src/agents/anomaly-agent.ts`)
- Anomaly agent → Audit: records incidents (evidence: `src/agents/anomaly-agent.ts`)
- Evaluation agent → Evaluation: gets criteria, writes scores (evidence: `src/agents/evaluation-agent.ts`)
- Evaluation agent → Submissions: reads offers (evidence: `src/agents/evaluation-agent.ts`)
- Evaluation agent → Document analysis: extracts offer text (evidence: `src/agents/evaluation-agent.ts`)
- Evaluation agent → LLM: scores, aggregates (evidence: `src/agents/evaluation-agent.ts`)
- Evaluation agent → Audit: logs decision (evidence: `src/agents/evaluation-agent.ts`)
- CDC drafting agent → Tenders (AO): reads tender context (evidence: `src/agents/genai-cdc-agent.ts`)
- CDC drafting agent → LLM: drafts, checks bias (evidence: `src/agents/genai-cdc-agent.ts`)
- CDC drafting agent → Audit: logs decision (evidence: `src/agents/genai-cdc-agent.ts`)
- Direct-award agent → Tenders (AO): reads tender (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Users: reads profile (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Documents: gets document URLs (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Storage: gets URLs (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Document analysis: extracts text (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → LLM: scores, classifies (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Tenders (AO): writes assessment (evidence: `src/agents/gre-a-gre-agent.ts`)
- Direct-award agent → Audit: logs decision (evidence: `src/agents/gre-a-gre-agent.ts`)
