How dabai-fu/travel_harness works
PyTravel-Harness is a multi-tenant enterprise travel and budget-analysis assistant. An employee signs in and submits a request through the web workspace; the gateway authenticates the user, and the run manager routes the request into LangGraph workflows for trip planning and booking, policy questions, expense drafts, or budget insights. The workflows use LLMs and MCP integrations, with human confirmation for consequential actions, then stream results to the workspace. The graph includes key security, middleware, and persistence layers. The README documents several capabilities whose implementation was not sampled; those subsystem links are shown only where documented.
Main entry points: run_manager.py Run manager · master.py Workflow graph · mcp_client.py MCP client · App.tsx Web workspace
Components 30
User experience
- Web workspace
frontend/src/App.tsx - Chat store
frontend/src/store/chatStore.ts
Agent orchestration
- API gateway
apps/api_gateway/main.py - Chat route
apps/api_gateway/routes/chat.py - Run manager
apps/agent_harness/runtime/run_manager.py - Intent routing
apps/agent_harness/router/l3_llm.py - Trip planning
apps/agent_harness/graphs/trip_plan_book.py - Policy answers
apps/agent_harness/graphs/policy_info.py - Expense drafts
apps/agent_harness/graphs/expense_draft.py - Budget insights
apps/agent_harness/graphs/budget_insight.py - Workflow graph
apps/agent_harness/graphs/master.py - LLM client
apps/agent_harness/runtime/llm_client.py
Enterprise integrations
- MCP client
apps/agent_harness/runtime/mcp_client.py - Travel provider
apps/mcp_servers/tuniu_mcp.py - OA service
apps/mcp_servers/oa_mcp.py - Expense ERP
apps/mcp_servers/erp_expense_mcp.py - Weather service
apps/mcp_servers/weather_mcp.py - Isolated sandbox
apps/agent_harness/sandbox/docker_runner.py
Security and state
- Authentication
apps/api_gateway/auth.py - Action guardrails
apps/agent_harness/runtime/guardrails.py - Tenant context
apps/agent_harness/middlewares/tenant_context.py - Middleware pipeline
apps/agent_harness/middlewares/pipeline.py - Context engineering
apps/agent_harness/middlewares/context_engineering.py - Preference memory
apps/agent_harness/runtime/services.py - Workflow state
apps/agent_harness/state.py - PostgreSQL
apps/common/db.py - Redis
apps/common/redis_client.py - Circuit breaker
apps/agent_harness/middlewares/circuit_breaker.py - Cluster cancellation
apps/agent_harness/middlewares/cluster_cancel.py
Other components
- Employee
Connections 37
- Employee → Web workspace: uses
README.md - Web workspace → Chat store: dispatches
frontend/src/App.tsx - Web workspace → API gateway: sends requests
README.md - API gateway → Authentication: registers
apps/api_gateway/main.py - API gateway → Chat route: registers
apps/api_gateway/main.py - Chat route → Authentication: authenticates
apps/api_gateway/routes/chat.py - Chat route → Run manager: starts run
apps/api_gateway/routes/chat.py - Run manager → Intent routing: routes query
apps/agent_harness/runtime/run_manager.py - Run manager → Workflow graph: executes graph
apps/agent_harness/runtime/run_manager.py - Workflow graph → Trip planning: dispatches
apps/agent_harness/graphs/master.py - Workflow graph → Policy answers: dispatches
apps/agent_harness/graphs/master.py - Workflow graph → Expense drafts: dispatches
apps/agent_harness/graphs/master.py - Workflow graph → Budget insights: dispatches
apps/agent_harness/graphs/master.py - Run manager → Workflow state: updates
apps/agent_harness/runtime/run_manager.py - Run manager → Preference memory: loads memory
apps/agent_harness/runtime/run_manager.py - Trip planning → MCP client: calls tools
apps/agent_harness/graphs/trip_plan_book.py - Trip planning → Action guardrails: checks actions
apps/agent_harness/graphs/trip_plan_book.py - MCP client → Travel provider: calls
apps/agent_harness/runtime/mcp_client.py - MCP client → OA service: calls
apps/agent_harness/runtime/mcp_client.py - MCP client → Expense ERP: calls
apps/agent_harness/runtime/mcp_client.py - MCP client → Weather service: calls
apps/agent_harness/runtime/mcp_client.py - Expense ERP → Isolated sandbox: runs analysis
apps/mcp_servers/erp_expense_mcp.py - Run manager → LLM client: invokes
apps/agent_harness/runtime/run_manager.py - LLM client → Middleware pipeline: prepares prompts
apps/agent_harness/runtime/llm_client.py - Middleware pipeline → Context engineering: applies
apps/agent_harness/middlewares/pipeline.py - Run manager → Tenant context: binds context
apps/agent_harness/runtime/run_manager.py - Authentication → PostgreSQL: loads identity
apps/api_gateway/auth.py - Authentication → Redis: checks session
apps/api_gateway/auth.py - Run manager → PostgreSQL: persists conversation
apps/agent_harness/runtime/run_manager.py - Preference memory → PostgreSQL: reads preferences
apps/agent_harness/runtime/services.py - Preference memory → Redis: caches preferences
apps/agent_harness/runtime/services.py - Travel provider → Circuit breaker: uses breaker
apps/mcp_servers/tuniu_mcp.py - Chat route → Cluster cancellation: checks cancellation
apps/api_gateway/routes/chat.py - Cluster cancellation → Redis: stores markers
apps/agent_harness/middlewares/cluster_cancel.py - Circuit breaker → Redis: stores state
apps/agent_harness/middlewares/circuit_breaker.py - Run manager → Web workspace: streams results
README.md - Web workspace → Employee: shows results
README.md