How gsc-lab/course-aiagent-lab-refund works
This repository is a Korean-language order and refund support agent: it analyzes a customer request with Claude, verifies orders and refund eligibility in Python, performs idempotent simulated refunds, and returns a customer response. The main CLI assembles State, policy, and tools, then runs the workflow through a Python execution loop or an optional LangGraph adapter. Runtime applies limits and retries and persists traces and checkpoints; SQLite stores refund records. The README documents scenarios, input-waiting and resume, escalation, and a smaller in-memory teaching example. Source excerpts establish core calls; some persistence and workflow links are documented in the README rather than fully excerpted.
Main entry points: runtime.py Runtime loop · main.py Agent CLI · state.py Workflow state · llm.py Claude adapter
Components 19
Entry and engines
- Agent CLI
src/refund_agent/main.py - LangGraph engine
src/refund_agent/langgraph_version.py - Basic example
src/refund_agent/basic.py
Request workflow
- Request analysis
src/refund_agent/nodes.py - Order lookup
src/refund_agent/nodes.py - Refund assessment
src/refund_agent/nodes.py - Refund processing
src/refund_agent/nodes.py - Customer response
src/refund_agent/nodes.py - Workflow routing
src/refund_agent/nodes.py
Execution controls
- Runtime loop
src/refund_agent/runtime.py - Workflow state
src/refund_agent/state.py - Execution policy
src/refund_agent/state.py - Trace logging
src/refund_agent/runtime.py - Checkpoint resume
src/refund_agent/runtime.py
Models and order service
- Claude adapter
src/refund_agent/llm.py - Mock order API
src/refund_agent/tools.py - Refund records
src/refund_agent/tools.py
Other components
- Customer
- Claude API
Connections 27
- Customer → Agent CLI: submits request
README.md - Agent CLI → Workflow state: creates or restores
src/refund_agent/main.py - Agent CLI → Execution policy: configures
src/refund_agent/main.py - Agent CLI → Runtime loop: starts
src/refund_agent/main.py - Agent CLI → Mock order API: configures
src/refund_agent/main.py - Agent CLI → LangGraph engine: selects optionally
src/refund_agent/main.py - Agent CLI → Runtime loop: runs Python engine
src/refund_agent/main.py - Runtime loop → Request analysis: executes node
src/refund_agent/runtime.py - Runtime loop → Workflow state: updates and checkpoints
src/refund_agent/runtime.py - Runtime loop → Execution policy: enforces limits
src/refund_agent/runtime.py - Runtime loop → Trace logging: records events
README.md - Runtime loop → Checkpoint resume: saves and loads
README.md - Request analysis → Claude adapter: requests analysis
README.md - Claude adapter → Claude API: sends messages
src/refund_agent/llm.py - Runtime loop → Claude adapter: calls with limits
src/refund_agent/runtime.py - Runtime loop → Mock order API: dispatches tool calls
src/refund_agent/runtime.py - Order lookup → Runtime loop: requests order data
src/refund_agent/nodes.py - Refund assessment → Workflow state: reads order
src/refund_agent/nodes.py - Refund processing → Runtime loop: requests refund tools
src/refund_agent/nodes.py - Mock order API → Refund records: reads and writes
src/refund_agent/tools.py - Workflow routing → Workflow state: reads workflow status
src/refund_agent/nodes.py - Runtime loop → Workflow routing: chooses next node
src/refund_agent/runtime.py - Customer response → Workflow state: stores response
src/refund_agent/nodes.py - LangGraph engine → Runtime loop: invokes runtime step
src/refund_agent/langgraph_version.py - LangGraph engine → Workflow routing: uses route
src/refund_agent/langgraph_version.py - Basic example → Claude adapter: uses analyzer
src/refund_agent/basic.py - Customer → Basic example: runs example
README.md