# jayaprabhapalani/evals_handson architecture

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

- Interactive diagram: https://gitdiagram.com/jayaprabhapalani/evals_handson
- Repository: https://github.com/jayaprabhapalani/evals_handson

## Overview

This repository implements a conversational customer-support agent for investigating purchase histories and handling refund requests. A customer interacts through the conversation loop; the agent uses a language model, prompt, and tools to identify purchases, calculate refund eligibility and amounts, and issue a refund ticket. The tools read customer and purchase data through a SQLite query layer. Source excerpts show the main calls and data access; no README is present, and database setup details are not needed to describe the runtime workflow.

Main entry points: [`agent/tools.py`](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py) (Refund tools), [`agent/agent.py`](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/agent.py) (Conversation loop), [`agent/Data/database.py`](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/Data/database.py) (SQLite query helpers), [`agent/Data/data.py`](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/Data/data.py) (Data compatibility)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation and reasoning"]
  node_conversation_loop["Conversation loop<br/>[agent.py]"]
  node_agent_runtime["Agent runtime<br/>[agent.py]"]
  node_system_prompt["Refund prompt<br/>[prompts.py]"]
  node_chat_model["Chat model<br/>[models.py]"]
  node_answer_schema["Answer schema<br/>[objects.py]"]
end

subgraph group_refund["Refund operations"]
  node_refund_tools["Refund tools<br/>[tools.py]"]
  node_purchase_history["Purchase history<br/>[tools.py]"]
  node_refund_calculation["Refund calculation<br/>[tools.py]"]
  node_ticket_issue["Ticket issuance<br/>[tools.py]"]
  node_current_date["Current date<br/>[tools.py]"]
  node_purchase_item["Purchase item<br/>[objects.py]"]
  node_refund_amount["Refund amount<br/>[objects.py]"]
end

subgraph group_data["Purchase data"]
  node_data_facade["Data compatibility<br/>[data.py]"]
  node_query_helpers["SQLite query helpers<br/>[database.py]"]
  node_sqlite_store[("SQLite store")]
end

node_customer(("Customer"))

node_customer -->|"sends request"| node_conversation_loop
node_conversation_loop -->|"invokes"| node_agent_runtime
node_conversation_loop -->|"validates response"| node_answer_schema
node_conversation_loop -->|"prints reply"| node_customer
node_agent_runtime -->|"uses model"| node_chat_model
node_agent_runtime -->|"uses prompt"| node_system_prompt
node_agent_runtime -->|"registers tools"| node_refund_tools
node_refund_tools -->|"registers"| node_purchase_history
node_refund_tools -->|"registers"| node_refund_calculation
node_refund_tools -->|"registers"| node_ticket_issue
node_refund_tools -->|"registers"| node_current_date
node_purchase_history -->|"reads purchases"| node_query_helpers
node_refund_calculation -->|"reads purchases"| node_query_helpers
node_refund_calculation -->|"matches items"| node_purchase_item
node_refund_calculation -->|"returns amount"| node_refund_amount
node_query_helpers -->|"queries"| node_sqlite_store
node_data_facade -->|"delegates queries"| node_query_helpers

click node_conversation_loop "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/agent.py"
click node_agent_runtime "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/agent.py"
click node_system_prompt "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/prompts.py"
click node_chat_model "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/models.py"
click node_answer_schema "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/objects.py"
click node_refund_tools "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py"
click node_purchase_history "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py"
click node_refund_calculation "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py"
click node_ticket_issue "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py"
click node_current_date "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py"
click node_purchase_item "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/objects.py"
click node_refund_amount "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/objects.py"
click node_data_facade "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/Data/data.py"
click node_query_helpers "https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/Data/database.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_conversation_loop,node_agent_runtime,node_system_prompt,node_chat_model,node_answer_schema toneBlue
class node_refund_tools,node_purchase_history,node_refund_calculation,node_ticket_issue,node_current_date,node_purchase_item,node_refund_amount toneAmber
class node_data_facade,node_query_helpers,node_sqlite_store toneMint
class node_customer toneIndigo
```

## Components

### Conversation and reasoning

- [Conversation loop](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/agent.py): `agent/agent.py`
- [Agent runtime](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/agent.py): `agent/agent.py`
- [Refund prompt](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/prompts.py): `agent/prompts.py`
- [Chat model](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/models.py): `agent/models.py`
- [Answer schema](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/objects.py): `agent/objects.py`

### Refund operations

- [Refund tools](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py): `agent/tools.py`
- [Purchase history](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py): `agent/tools.py`
- [Refund calculation](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py): `agent/tools.py`
- [Ticket issuance](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py): `agent/tools.py`
- [Current date](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/tools.py): `agent/tools.py`
- [Purchase item](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/objects.py): `agent/objects.py`
- [Refund amount](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/objects.py): `agent/objects.py`

### Purchase data

- [Data compatibility](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/Data/data.py): `agent/Data/data.py`
- [SQLite query helpers](https://github.com/jayaprabhapalani/evals_handson/blob/main/agent/Data/database.py): `agent/Data/database.py`
- **SQLite store**

### Other components

- **Customer**

## Connections

- Customer → Conversation loop: sends request (evidence: `agent/agent.py`)
- Conversation loop → Agent runtime: invokes (evidence: `agent/agent.py`)
- Conversation loop → Answer schema: validates response (evidence: `agent/agent.py`)
- Conversation loop → Customer: prints reply (evidence: `agent/agent.py`)
- Agent runtime → Chat model: uses model (evidence: `agent/agent.py`)
- Agent runtime → Refund prompt: uses prompt (evidence: `agent/agent.py`)
- Agent runtime → Refund tools: registers tools (evidence: `agent/agent.py`)
- Refund tools → Purchase history: registers (evidence: `agent/tools.py`)
- Refund tools → Refund calculation: registers (evidence: `agent/tools.py`)
- Refund tools → Ticket issuance: registers (evidence: `agent/tools.py`)
- Refund tools → Current date: registers (evidence: `agent/tools.py`)
- Purchase history → SQLite query helpers: reads purchases (evidence: `agent/tools.py`)
- Refund calculation → SQLite query helpers: reads purchases (evidence: `agent/tools.py`)
- Refund calculation → Purchase item: matches items (evidence: `agent/tools.py`)
- Refund calculation → Refund amount: returns amount (evidence: `agent/tools.py`)
- SQLite query helpers → SQLite store: queries (evidence: `agent/Data/database.py`)
- Data compatibility → SQLite query helpers: delegates queries (evidence: `agent/Data/data.py`)
