toga-ai 1.0.91 → 1.0.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
 
3
3
  | Doc | Summary | Files |
4
4
  |-----|---------|-------|
5
- | [TOGa IQ (talos) Architecture](architecture.md) | **TOGa IQ** is TOGA Technology's AI agent platform. | talos/libs/aegra-api/src/aegra_api/main.py, talos/libs/aegra-api/src/aegra_api/settings.py, talos/libs/aegra-api/src/aegra_api/config.py, talos/libs/aegra-api/src/aegra_api/core/tenant_router.py, talos/libs/aegra-api/src/aegra_api/core/control_plane_db.py, talos/libs/aegra-api/src/aegra_api/core/auth_middleware.py, talos/libs/aegra-api/src/aegra_api/services/run_executor.py, talos/libs/aegra-api/src/aegra_api/services/langgraph_service.py, talos/libs/aegra-api/src/aegra_api/services/graph_factory.py, talos/libs/aegra-api/src/aegra_api/services/streaming_service.py, talos/examples/react_agent/graph.py, talos/docker-compose.yml, talos/deployments/docker/Dockerfile |
5
+ | [TOGa IQ (talos) Architecture](architecture.md) | **TOGa IQ** is TOGA Technology's AI agent platform. | talos/libs/aegra-api/src/aegra_api/main.py, talos/libs/aegra-api/src/aegra_api/settings.py, talos/libs/aegra-api/src/aegra_api/config.py, talos/libs/aegra-api/src/aegra_api/core/tenant_router.py, talos/libs/aegra-api/src/aegra_api/core/control_plane_db.py, talos/libs/aegra-api/src/aegra_api/core/auth_middleware.py, talos/libs/aegra-api/src/aegra_api/services/run_executor.py, talos/libs/aegra-api/src/aegra_api/services/langgraph_service.py, talos/libs/aegra-api/src/aegra_api/services/graph_factory.py, talos/libs/aegra-api/src/aegra_api/services/streaming_service.py, talos/agents/talos_agent/graph.py, talos/docker-compose.yml, talos/deployments/docker/Dockerfile |
6
6
  | [aegra-api — Agent Protocol HTTP + Execution Pipeline](features/aegra-api.md) | `aegra-api` is the **FastAPI Agent Protocol server** at the heart of TOGa IQ. | talos/libs/aegra-api/src/aegra_api/main.py, talos/libs/aegra-api/src/aegra_api/settings.py, talos/libs/aegra-api/src/aegra_api/config.py, talos/libs/aegra-api/src/aegra_api/api/assistants.py, talos/libs/aegra-api/src/aegra_api/api/threads.py, talos/libs/aegra-api/src/aegra_api/api/runs.py, talos/libs/aegra-api/src/aegra_api/api/store.py, talos/libs/aegra-api/src/aegra_api/api/mcp.py, talos/libs/aegra-api/src/aegra_api/api/knowledge_bases.py, talos/libs/aegra-api/src/aegra_api/core/auth_middleware.py, talos/libs/aegra-api/src/aegra_api/core/auth_deps.py, talos/libs/aegra-api/src/aegra_api/core/tenant_router.py, talos/libs/aegra-api/src/aegra_api/core/control_plane_db.py, talos/libs/aegra-api/src/aegra_api/core/redis_manager.py, talos/libs/aegra-api/src/aegra_api/core/encryption.py, talos/libs/aegra-api/src/aegra_api/middleware/content_type_fix.py, talos/libs/aegra-api/src/aegra_api/middleware/rate_limiter.py, talos/libs/aegra-api/src/aegra_api/middleware/logger_middleware.py, talos/libs/aegra-api/src/aegra_api/services/broker.py, talos/libs/aegra-api/src/aegra_api/services/redis_broker.py, talos/libs/aegra-api/src/aegra_api/services/executor.py, talos/libs/aegra-api/src/aegra_api/services/local_executor.py, talos/libs/aegra-api/src/aegra_api/services/worker_executor.py, talos/libs/aegra-api/src/aegra_api/services/run_executor.py, talos/libs/aegra-api/src/aegra_api/services/langgraph_service.py, talos/libs/aegra-api/src/aegra_api/services/graph_factory.py, talos/libs/aegra-api/src/aegra_api/services/graph_streaming.py, talos/libs/aegra-api/src/aegra_api/services/streaming_service.py, talos/libs/aegra-api/src/aegra_api/services/event_store.py, talos/libs/aegra-api/alembic/env.py |
7
7
  | [Deployment — Docker, Compose, Entrypoint, External PG/Redis](features/deployment.md) | TOGa IQ ships as a **single container** (`aegra` service) wrapping the `aegra-api` FastAPI server. | talos/docker-compose.yml, talos/deployments/docker/Dockerfile, talos/deployments/docker/entrypoint.sh |
8
8
  | [MCP Servers — clickup-mcp and toga-db-mcp](features/mcp-servers.md) | Two internal **FastMCP** servers exposed over **HTTP** with API-key auth and PM2 process management: - **`clickup-mcp`** — ClickUp workspace surface (spaces / f | talos/mcp-servers/clickup-mcp/src, talos/mcp-servers/clickup-mcp/ecosystem.config.js, talos/mcp-servers/clickup-mcp/ecosystem.dev.config.js, talos/mcp-servers/clickup-mcp/pyproject.toml, talos/mcp-servers/clickup-mcp/.env.example, talos/mcp-servers/toga-db-mcp/src, talos/mcp-servers/toga-db-mcp/clusters.yaml, talos/mcp-servers/toga-db-mcp/ecosystem.config.js, talos/mcp-servers/toga-db-mcp/pyproject.toml, talos/mcp-servers/toga-db-mcp/.env.example |
9
9
  | [Observability — Langfuse, OTEL, Prometheus, OneUptime](features/observability.md) | TOGa IQ uses **two complementary tracing planes** plus optional Prometheus metrics and external uptime monitoring: - **Langfuse (native v3 SDK)** — LLM-shaped t | talos/libs/aegra-api/src/aegra_api/observability/__init__.py, talos/libs/aegra-api/src/aegra_api/observability/setup.py, talos/libs/aegra-api/src/aegra_api/observability/base.py, talos/libs/aegra-api/src/aegra_api/observability/langfuse_provider.py, talos/libs/aegra-api/src/aegra_api/observability/langfuse_client.py, talos/libs/aegra-api/src/aegra_api/observability/otel.py, talos/libs/aegra-api/src/aegra_api/observability/metrics.py, talos/libs/aegra-api/src/aegra_api/observability/span_enrichment.py, talos/libs/aegra-api/src/aegra_api/observability/targets |
10
- | [react_agent — LangGraph ReAct Agent with Plan, BLP, MCP, Canvas](features/react-agent.md) | `react_agent` is the **reference LangGraph agent** shipped under `examples/react_agent/`. | talos/examples/react_agent/graph.py, talos/examples/react_agent/state.py, talos/examples/react_agent/context.py, talos/examples/react_agent/prompts.py, talos/examples/react_agent/tool_router.py, talos/examples/react_agent/model_helpers.py, talos/examples/react_agent/config/context.py, talos/examples/react_agent/config/model_config.py, talos/examples/react_agent/config/tool_config.py, talos/examples/react_agent/config/plan_config.py, talos/examples/react_agent/config/memory_config.py, talos/examples/react_agent/config/mcp_config.py, talos/examples/react_agent/config/blp_config.py, talos/examples/react_agent/config/interrupt_config.py, talos/examples/react_agent/config/artifact_config.py, talos/examples/react_agent/plan/planner.py, talos/examples/react_agent/plan/nodes.py, talos/examples/react_agent/llm/system_prompt.py, talos/examples/react_agent/llm/tool_binding.py, talos/examples/react_agent/llm/message_ops.py, talos/examples/react_agent/mcp/client.py, talos/examples/react_agent/mcp/security.py, talos/examples/react_agent/mcp/session_manager.py, talos/examples/react_agent/blp/registry.py, talos/examples/react_agent/blp/embedder.py, talos/examples/react_agent/blp/nodes.py, talos/examples/react_agent/tools/__init__.py, talos/examples/react_agent/tools/code_interpreter.py, talos/examples/react_agent/tools/canvas.py, talos/examples/react_agent/tools/knowledge_base.py, talos/examples/react_agent/tools/skill_injector.py, talos/examples/react_agent/thread_name/nodes.py |
10
+ | [talos_agent — LangGraph ReAct Agent with Plan, BLP, MCP, Canvas](features/talos-agent.md) | `talos_agent` is the **reference LangGraph agent** shipped under `agents/talos_agent/`. | talos/agents/talos_agent/graph.py, talos/agents/talos_agent/state.py, talos/agents/talos_agent/context.py, talos/agents/talos_agent/prompts.py, talos/agents/talos_agent/tool_router.py, talos/agents/talos_agent/model_helpers.py, talos/agents/talos_agent/config/context.py, talos/agents/talos_agent/config/model_config.py, talos/agents/talos_agent/config/tool_config.py, talos/agents/talos_agent/config/plan_config.py, talos/agents/talos_agent/config/memory_config.py, talos/agents/talos_agent/config/mcp_config.py, talos/agents/talos_agent/config/blp_config.py, talos/agents/talos_agent/config/interrupt_config.py, talos/agents/talos_agent/config/artifact_config.py, talos/agents/talos_agent/plan/planner.py, talos/agents/talos_agent/plan/nodes.py, talos/agents/talos_agent/llm/system_prompt.py, talos/agents/talos_agent/llm/tool_binding.py, talos/agents/talos_agent/llm/message_ops.py, talos/agents/talos_agent/mcp/client.py, talos/agents/talos_agent/mcp/security.py, talos/agents/talos_agent/mcp/session_manager.py, talos/agents/talos_agent/blp/registry.py, talos/agents/talos_agent/blp/embedder.py, talos/agents/talos_agent/blp/nodes.py, talos/agents/talos_agent/tools/__init__.py, talos/agents/talos_agent/tools/code_interpreter.py, talos/agents/talos_agent/tools/canvas.py, talos/agents/talos_agent/tools/knowledge_base.py, talos/agents/talos_agent/tools/skill_injector.py, talos/agents/talos_agent/thread_name/nodes.py |
@@ -19,12 +19,12 @@ files:
19
19
  - talos/libs/aegra-api/src/aegra_api/services/langgraph_service.py
20
20
  - talos/libs/aegra-api/src/aegra_api/services/graph_factory.py
21
21
  - talos/libs/aegra-api/src/aegra_api/services/streaming_service.py
22
- - talos/examples/react_agent/graph.py
22
+ - talos/agents/talos_agent/graph.py
23
23
  - talos/docker-compose.yml
24
24
  - talos/deployments/docker/Dockerfile
25
25
  related:
26
26
  - features/aegra-api.md
27
- - features/react-agent.md
27
+ - features/talos-agent.md
28
28
  - features/mcp-servers.md
29
29
  - features/observability.md
30
30
  - features/deployment.md
@@ -56,7 +56,7 @@ talos/
56
56
  │ │ ├── observability/ # Langfuse native + OTEL providers, Prometheus
57
57
  │ │ └── main.py # FastAPI app factory + lifespan
58
58
  │ └── alembic/ # 20 schema migrations (Jan 2025 → Mar 2026)
59
- ├── examples/react_agent/ # Reference LangGraph agent (graph, plan, tools, blp, mcp)
59
+ ├── agents/talos_agent/ # Reference LangGraph agent (graph, plan, tools, blp, mcp)
60
60
  ├── mcp-servers/
61
61
  │ ├── clickup-mcp/ # ClickUp HTTP MCP (PM2-managed, ports 8200/8201)
62
62
  │ └── toga-db-mcp/ # Multi-cluster MySQL read MCP (port 8000)
@@ -75,10 +75,10 @@ talos/
75
75
  Redis BLPOP worker queue with lease-based crash recovery. SSE replay is
76
76
  backed by an in-memory ring + Postgres `run_events` table. See
77
77
  `features/aegra-api.md`.
78
- 3. **Reference agent (LangGraph)** — `examples/react_agent`. A ReAct graph with
78
+ 3. **Reference agent (LangGraph)** — `agents/talos_agent`. A ReAct graph with
79
79
  optional planner gate, tool router, BLP semantic context selection,
80
80
  running-summary memory, canvas artifacts, code-interpreter offload, and MCP
81
- passthrough. See `features/react-agent.md`.
81
+ passthrough. See `features/talos-agent.md`.
82
82
  4. **MCP fleet** — `clickup-mcp` and `toga-db-mcp`. Both FastMCP servers
83
83
  exposed over HTTP, API-key gated, PM2-managed, with OneUptime heartbeats.
84
84
  `toga-db-mcp` is the canonical read-only data plane across 4 prod clusters
@@ -21,7 +21,7 @@ files:
21
21
  - talos/mcp-servers/toga-db-mcp/.env.example
22
22
  related:
23
23
  - ../architecture.md
24
- - react-agent.md
24
+ - talos-agent.md
25
25
  - deployment.md
26
26
  ---
27
27
 
@@ -36,7 +36,7 @@ PM2 process management:
36
36
  legacy, and 16 non-prod environments. The **canonical** path for the agent
37
37
  to read TOGa data.
38
38
 
39
- Both are consumed by the `react_agent` via the standard MCP loader and by
39
+ Both are consumed by the `talos_agent` via the standard MCP loader and by
40
40
  external clients (Claude Desktop, internal tooling) via API-key auth.
41
41
 
42
42
  ## Key files / entry points
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: react_agent — LangGraph ReAct Agent with Plan, BLP, MCP, Canvas
2
+ title: talos_agent — LangGraph ReAct Agent with Plan, BLP, MCP, Canvas
3
3
  framework: "2.0"
4
4
  repo: talos
5
5
  project: TOGa IQ
@@ -9,38 +9,38 @@ status: active
9
9
  updated: 2026-06-16
10
10
  owners: [akhokhani]
11
11
  files:
12
- - talos/examples/react_agent/graph.py
13
- - talos/examples/react_agent/state.py
14
- - talos/examples/react_agent/context.py
15
- - talos/examples/react_agent/prompts.py
16
- - talos/examples/react_agent/tool_router.py
17
- - talos/examples/react_agent/model_helpers.py
18
- - talos/examples/react_agent/config/context.py
19
- - talos/examples/react_agent/config/model_config.py
20
- - talos/examples/react_agent/config/tool_config.py
21
- - talos/examples/react_agent/config/plan_config.py
22
- - talos/examples/react_agent/config/memory_config.py
23
- - talos/examples/react_agent/config/mcp_config.py
24
- - talos/examples/react_agent/config/blp_config.py
25
- - talos/examples/react_agent/config/interrupt_config.py
26
- - talos/examples/react_agent/config/artifact_config.py
27
- - talos/examples/react_agent/plan/planner.py
28
- - talos/examples/react_agent/plan/nodes.py
29
- - talos/examples/react_agent/llm/system_prompt.py
30
- - talos/examples/react_agent/llm/tool_binding.py
31
- - talos/examples/react_agent/llm/message_ops.py
32
- - talos/examples/react_agent/mcp/client.py
33
- - talos/examples/react_agent/mcp/security.py
34
- - talos/examples/react_agent/mcp/session_manager.py
35
- - talos/examples/react_agent/blp/registry.py
36
- - talos/examples/react_agent/blp/embedder.py
37
- - talos/examples/react_agent/blp/nodes.py
38
- - talos/examples/react_agent/tools/__init__.py
39
- - talos/examples/react_agent/tools/code_interpreter.py
40
- - talos/examples/react_agent/tools/canvas.py
41
- - talos/examples/react_agent/tools/knowledge_base.py
42
- - talos/examples/react_agent/tools/skill_injector.py
43
- - talos/examples/react_agent/thread_name/nodes.py
12
+ - talos/agents/talos_agent/graph.py
13
+ - talos/agents/talos_agent/state.py
14
+ - talos/agents/talos_agent/context.py
15
+ - talos/agents/talos_agent/prompts.py
16
+ - talos/agents/talos_agent/tool_router.py
17
+ - talos/agents/talos_agent/model_helpers.py
18
+ - talos/agents/talos_agent/config/context.py
19
+ - talos/agents/talos_agent/config/model_config.py
20
+ - talos/agents/talos_agent/config/tool_config.py
21
+ - talos/agents/talos_agent/config/plan_config.py
22
+ - talos/agents/talos_agent/config/memory_config.py
23
+ - talos/agents/talos_agent/config/mcp_config.py
24
+ - talos/agents/talos_agent/config/blp_config.py
25
+ - talos/agents/talos_agent/config/interrupt_config.py
26
+ - talos/agents/talos_agent/config/artifact_config.py
27
+ - talos/agents/talos_agent/plan/planner.py
28
+ - talos/agents/talos_agent/plan/nodes.py
29
+ - talos/agents/talos_agent/llm/system_prompt.py
30
+ - talos/agents/talos_agent/llm/tool_binding.py
31
+ - talos/agents/talos_agent/llm/message_ops.py
32
+ - talos/agents/talos_agent/mcp/client.py
33
+ - talos/agents/talos_agent/mcp/security.py
34
+ - talos/agents/talos_agent/mcp/session_manager.py
35
+ - talos/agents/talos_agent/blp/registry.py
36
+ - talos/agents/talos_agent/blp/embedder.py
37
+ - talos/agents/talos_agent/blp/nodes.py
38
+ - talos/agents/talos_agent/tools/__init__.py
39
+ - talos/agents/talos_agent/tools/code_interpreter.py
40
+ - talos/agents/talos_agent/tools/canvas.py
41
+ - talos/agents/talos_agent/tools/knowledge_base.py
42
+ - talos/agents/talos_agent/tools/skill_injector.py
43
+ - talos/agents/talos_agent/thread_name/nodes.py
44
44
  related:
45
45
  - ../architecture.md
46
46
  - aegra-api.md
@@ -49,8 +49,8 @@ related:
49
49
 
50
50
  ## Summary
51
51
 
52
- `react_agent` is the **reference LangGraph agent** shipped under
53
- `examples/react_agent/`. It is a production-grade ReAct loop with an optional
52
+ `talos_agent` is the **reference LangGraph agent** shipped under
53
+ `agents/talos_agent/`. It is a production-grade ReAct loop with an optional
54
54
  **planner** gate, an LLM-driven **tool router**, **BLP** semantic context
55
55
  selection, running-summary memory compaction, a versioned **canvas** artifact,
56
56
  **code-interpreter** offload (Bedrock AgentCore), and transparent **MCP**
@@ -202,4 +202,5 @@ Add a client override by configuring its assistant, not by forking the graph.
202
202
  recursion limit. Raise the limit in graph build before raising expectations.
203
203
 
204
204
  ## Change history
205
- - 2026-06-16 — Initial react_agent feature doc. (akhokhani)
205
+ - 2026-06-16 — Renamed `examples/react_agent/` `agents/talos_agent/`; sibling example dirs (`react_agent_hitl`, `subgraph_agent`, `subgraph_hitl_agent`) and example scripts removed. `aegra.json` now points `dependencies: ["./agents"]`; graph entry is `./agents/talos_agent/graph.py:graph`. Module import is `from talos_agent.graph import graph`. (akhokhani)
206
+ - 2026-06-16 — Initial feature doc. (akhokhani)
@@ -0,0 +1,8 @@
1
+ # voice-to-voice (TOGa Voice) — 2.0 knowledge
2
+
3
+ | Doc | Summary | Files |
4
+ |-----|---------|-------|
5
+ | [TOGa Voice (voice-to-voice) Architecture](architecture.md) | **TOGa Voice** (`voice-to-voice`) is a multi-tenant **LiveKit Agents**–based phone voice agent platform. | voice-to-voice/core/base_config.py, voice-to-voice/core/utils.py, voice-to-voice/core/services/egress.py, voice-to-voice/core/services/knowledge_base.py, voice-to-voice/core/services/s3_upload.py, voice-to-voice/core/services/ticket_api.py, voice-to-voice/clients/odp/agent.py, voice-to-voice/clients/odp/agents/tech_support.py, voice-to-voice/clients/odp/config.yaml, voice-to-voice/clients/odp/prompts.py, voice-to-voice/clients/odp/Dockerfile, voice-to-voice/clients/odp/deploy.sh, voice-to-voice/clients/odp/livekit.toml, voice-to-voice/lambda_updated/lambda_function.py, voice-to-voice/docs/CLIENT_ONBOARDING_SOP.md, voice-to-voice/docs/inbound-call-routing-rd.md |
6
+ | [LiveKit Voice Pipeline — STT / LLM / TTS / VAD / Turn Detection](features/livekit-pipeline.md) | The active voice loop is **fully AWS-native**: Amazon Transcribe (STT) → Bedrock Claude (LLM) → Amazon Polly (TTS), with Silero VAD and LiveKit's multilingual t | voice-to-voice/clients/odp/agent.py, voice-to-voice/clients/odp/agents/tech_support.py, voice-to-voice/clients/odp/livekit.toml, voice-to-voice/clients/odp/Dockerfile, voice-to-voice/clients/odp/deploy.sh, voice-to-voice/clients/odp/pyproject.toml, voice-to-voice/core/services/egress.py, voice-to-voice/core/services/knowledge_base.py |
7
+ | [Post-Call Lambda — Transcript Conversion, Report, Ticket Attachment](features/post-call-lambda.md) | After every call, an AWS Lambda picks up the S3 ticket folder the agent left behind, converts the transcript to API format, generates a TXT report of the conver | voice-to-voice/lambda_updated/lambda_function.py, voice-to-voice/lambda_updated/api_client.py, voice-to-voice/lambda_updated/report_generator.py, voice-to-voice/lambda_updated/transcript_converter.py, voice-to-voice/lambda_updated/requirements.txt |
8
+ | [Agilant Ticket API — TOGa Desk 1.0 Integration](features/ticket-api-integration.md) | This is the **single seam** between the new Python voice agent and the legacy **TOGa Desk 1.0** PHP ticketing app. | voice-to-voice/core/services/ticket_api.py, voice-to-voice/lambda_updated/api_client.py, voice-to-voice/lambda_updated/lambda_function.py, voice-to-voice/clients/odp/agent.py, voice-to-voice/clients/odp/config.yaml, voice-to-voice/scripts/test_ticket_api.sh, voice-to-voice/docs/inbound-call-routing-rd.md |
@@ -0,0 +1,181 @@
1
+ ---
2
+ title: TOGa Voice (voice-to-voice) Architecture
3
+ framework: "2.0"
4
+ repo: voice-to-voice
5
+ project: TOGa Voice
6
+ client: shared
7
+ type: architecture
8
+ status: active
9
+ updated: 2026-06-16
10
+ owners: [akhokhani]
11
+ files:
12
+ - voice-to-voice/core/base_config.py
13
+ - voice-to-voice/core/utils.py
14
+ - voice-to-voice/core/services/egress.py
15
+ - voice-to-voice/core/services/knowledge_base.py
16
+ - voice-to-voice/core/services/s3_upload.py
17
+ - voice-to-voice/core/services/ticket_api.py
18
+ - voice-to-voice/clients/odp/agent.py
19
+ - voice-to-voice/clients/odp/agents/tech_support.py
20
+ - voice-to-voice/clients/odp/config.yaml
21
+ - voice-to-voice/clients/odp/prompts.py
22
+ - voice-to-voice/clients/odp/Dockerfile
23
+ - voice-to-voice/clients/odp/deploy.sh
24
+ - voice-to-voice/clients/odp/livekit.toml
25
+ - voice-to-voice/lambda_updated/lambda_function.py
26
+ - voice-to-voice/docs/CLIENT_ONBOARDING_SOP.md
27
+ - voice-to-voice/docs/inbound-call-routing-rd.md
28
+ related:
29
+ - features/livekit-pipeline.md
30
+ - features/ticket-api-integration.md
31
+ - features/post-call-lambda.md
32
+ ---
33
+
34
+ ## Summary
35
+
36
+ **TOGa Voice** (`voice-to-voice`) is a multi-tenant **LiveKit Agents**–based
37
+ phone voice agent platform. A shared `core/` layer provides config, AWS
38
+ service wrappers, and the Agilant Ticket API client; each tenant lives in
39
+ `clients/<slug>/` as its own container deployed to **LiveKit Cloud**. Today
40
+ the only deployed tenant is **Office Depot (ODP)** — a Tier-1 tech-support
41
+ agent for store associates, integrated with TOGa Desk 1.0 via the
42
+ **Agilant Ticket API**. A separate AWS **Lambda** processes post-call
43
+ artifacts (audio + report) and attaches them back to the ticket.
44
+
45
+ The platform sits under `2.0/apps/` for the same reason as **talos**: it's
46
+ Python (not PHP), but its consumers (callers of Office Depot stores) and
47
+ ticket destination (TOGa Desk 1.0) are 2.0-era TOGa surfaces; tooling and
48
+ conventions match the rest of the Python fleet.
49
+
50
+ ## Top-level layout
51
+
52
+ ```
53
+ voice-to-voice-new/
54
+ ├── core/ # shared platform code
55
+ │ ├── base_config.py # pydantic-settings: YAML + env precedence
56
+ │ ├── utils.py # phone sanitization, SigV4 redaction
57
+ │ └── services/
58
+ │ ├── egress.py # LiveKit RoomCompositeEgress → S3 .ogg
59
+ │ ├── knowledge_base.py # Bedrock KB retrieve() + TTL cache
60
+ │ ├── s3_upload.py # raw .ogg → ticket folder; report JSON upload
61
+ │ └── ticket_api.py # Agilant Ticket API client (HMAC-SHA256)
62
+ ├── clients/
63
+ │ └── odp/ # Office Depot deployment
64
+ │ ├── agent.py # LiveKit session entrypoint
65
+ │ ├── agents/tech_support.py # TalosAgent — tools + greeting
66
+ │ ├── config.yaml # non-secret client settings
67
+ │ ├── prompts.py # system prompt (call flow + output rules)
68
+ │ ├── Dockerfile # uv-based multi-stage build
69
+ │ ├── deploy.sh # copy core/ → build → `lk agent deploy`
70
+ │ └── livekit.toml # LiveKit Cloud project + agent id
71
+ ├── lambda_updated/ # AWS Lambda post-call processor
72
+ │ ├── lambda_function.py # EventBridge/S3-triggered orchestrator
73
+ │ ├── api_client.py # PUT /ticket/{n} with HMAC
74
+ │ ├── report_generator.py # TXT report builder
75
+ │ └── transcript_converter.py # session_report.json → API transcript fmt
76
+ ├── docs/
77
+ │ ├── CLIENT_ONBOARDING_SOP.md # 14-phase new-tenant runbook
78
+ │ ├── inbound-call-routing-rd.md # phone → LiveKit → agent flow
79
+ │ └── toga-voice-architecture.html
80
+ └── scripts/test_ticket_api.sh
81
+ ```
82
+
83
+ ## Multi-tenant model
84
+
85
+ - **One container per client.** Each `clients/<slug>/` is its own image
86
+ pushed to LiveKit Cloud as its own agent worker. They share a single AWS
87
+ account and a single S3 bucket; isolation is by **client-prefixed S3 keys**
88
+ (`odp/upload/...`) and per-client env (Bedrock KB id, ticket API keys).
89
+ - **`deploy.sh` copies `core/` into the client folder before build.** The
90
+ Dockerfile builds from the client directory; without the copy step `core/`
91
+ is missing in the image. Future improvement: install `core/` as a wheel.
92
+ - **Onboarding** (`docs/CLIENT_ONBOARDING_SOP.md`) is a copy-and-customize
93
+ flow, not a code-generation flow — copy `clients/odp/` to
94
+ `clients/<new>/`, edit prompts/config/env, deploy.
95
+
96
+ ## Voice pipeline
97
+
98
+ The active pipeline is **fully AWS-native** (no Deepgram / Cartesia /
99
+ OpenAI):
100
+
101
+ | Stage | Plugin | Notes |
102
+ |---|---|---|
103
+ | STT | Amazon Transcribe (`en-US`) | Wrapped in `FallbackAdapter` (two instances) to survive Transcribe's 15s idle timeout |
104
+ | LLM | Bedrock Claude — Haiku primary, Sonnet fallback | `FallbackAdapter`, `temp=0.4`, `max_tokens=300` |
105
+ | TTS | Amazon Polly (`Matthew`, engine `generative`) | Preemptive generation for latency |
106
+ | VAD | Silero (downloaded at build) | Loaded in worker prewarm (`agent.py:115`) |
107
+ | Turn detection | LiveKit multilingual model | Endpointing 0.5–0.8s; interruption threshold 1 word |
108
+
109
+ Pipeline wiring is in `clients/odp/agent.py:162–222`. Plugin versions are
110
+ pinned via `livekit-agents[silero,turn-detector,aws]~=1.4`.
111
+
112
+ ## Deployment
113
+
114
+ - **Runtime:** LiveKit Cloud agent worker (managed). No self-hosted infra.
115
+ - **Container:** multi-stage Dockerfile, uv-based, Python 3.12, non-root
116
+ user UID 10001. Silero VAD + turn-detector weights downloaded at build
117
+ time so cold starts don't fetch.
118
+ - **Entry:** `uv run agent.py start` (LiveKit Agents `WorkerOptions`).
119
+ - **Secrets:** synced via `lk agent update-secrets --secrets-file .env
120
+ --overwrite` before each deploy. `.env` never enters the image.
121
+ - **Rollback:** `lk agent rollback` and `lk agent logs`.
122
+
123
+ See `features/livekit-pipeline.md`.
124
+
125
+ ## Integration with TOGa Desk 1.0 (Agilant Ticket API)
126
+
127
+ **Critical:** the voice agent does **not** call the standard TOGa Desk PHP
128
+ `/desk/api/` endpoint. It calls a separate **Agilant Ticket API** at
129
+ `https://api.agilantsolutions.com` (HMAC-SHA256 auth) which abstracts over
130
+ the underlying TOGa Desk 1.0 ticketing tables. The same API is hit twice:
131
+
132
+ 1. **During the call** — `core/services/ticket_api.py` GETs by callback
133
+ number and work order for repeat-caller detection, then POSTs a new
134
+ ticket at end of call.
135
+ 2. **After the call** — `lambda_updated/api_client.py` PUTs the transcript +
136
+ audio + TXT report to `/ticket/{number}` to attach artifacts.
137
+
138
+ Full contract, payload shapes, HMAC scheme, and PII considerations live in
139
+ `features/ticket-api-integration.md`. TOGa Desk PHP side: see
140
+ `1.0/apps/togadesk/architecture.md` for which underlying tables/controllers
141
+ carry this traffic.
142
+
143
+ ## Storage
144
+
145
+ - **S3 bucket** `talos-voice-to-voice` (shared, client-prefixed):
146
+ - `odp/upload/raw/<session_id>.ogg` — LiveKit egress staging.
147
+ - `odp/upload/<ticketNo>_<sessionId>_<refId>/`
148
+ - `call_recording.ogg` (moved from `raw/`)
149
+ - `session_report.json` (agent-written; triggers Lambda)
150
+ - `odp/processed/...` — Lambda destination on success.
151
+ - `odp/unprocessable/...` — no ticket number extractable.
152
+ - **Bedrock Knowledge Base** — per-client KB id; documents uploaded to
153
+ `togaiq/<category>/<client_id>/archived/`.
154
+ - **No primary DB.** Ticket state lives in TOGa Desk via the Ticket API.
155
+
156
+ ## Observability
157
+
158
+ - LiveKit Cloud logs (`lk agent logs`).
159
+ - Lambda → CloudWatch.
160
+ - **No Langfuse / OTEL today.** Adding them requires an `observability/`
161
+ module mirroring talos's pattern; not yet built. This is the largest
162
+ known gap.
163
+
164
+ ## Key decisions
165
+
166
+ - **AWS-native voice stack** — Transcribe + Bedrock + Polly. No external
167
+ voice vendors. Simpler IAM, single billing surface; ties us to AWS voice
168
+ quality.
169
+ - **`core/` is copied into the build, not installed as a package.** Pragmatic
170
+ today, brittle if `core/` grows or two clients pin different versions.
171
+ - **Custom Ticket API**, not direct TOGa Desk PHP — gives a stable contract
172
+ decoupled from the PHP framework's internal schema. The Agilant Ticket
173
+ API is the single seam between voice and Desk 1.0.
174
+ - **Lambda post-processing**, not in-process. Keeps the agent worker hot;
175
+ post-call work is idempotent + retriable from S3 state.
176
+ - **One ticket per call invariant** — `ensure_ticket_created_for_call`
177
+ (`core/services/ticket_api.py`) guarantees creation even if the LLM
178
+ forgot to call the tool.
179
+
180
+ ## Change history
181
+ - 2026-06-16 — Initial architecture doc for voice-to-voice (TOGa Voice), with ODP as the first tenant. (akhokhani)
@@ -0,0 +1,147 @@
1
+ ---
2
+ title: LiveKit Voice Pipeline — STT / LLM / TTS / VAD / Turn Detection
3
+ framework: "2.0"
4
+ repo: voice-to-voice
5
+ project: TOGa Voice
6
+ client: shared
7
+ type: feature
8
+ status: active
9
+ updated: 2026-06-16
10
+ owners: [akhokhani]
11
+ files:
12
+ - voice-to-voice/clients/odp/agent.py
13
+ - voice-to-voice/clients/odp/agents/tech_support.py
14
+ - voice-to-voice/clients/odp/livekit.toml
15
+ - voice-to-voice/clients/odp/Dockerfile
16
+ - voice-to-voice/clients/odp/deploy.sh
17
+ - voice-to-voice/clients/odp/pyproject.toml
18
+ - voice-to-voice/core/services/egress.py
19
+ - voice-to-voice/core/services/knowledge_base.py
20
+ related:
21
+ - ../architecture.md
22
+ - ticket-api-integration.md
23
+ - post-call-lambda.md
24
+ ---
25
+
26
+ ## Summary
27
+
28
+ The active voice loop is **fully AWS-native**: Amazon Transcribe (STT) →
29
+ Bedrock Claude (LLM) → Amazon Polly (TTS), with Silero VAD and LiveKit's
30
+ multilingual turn detector. Wrapped in LiveKit Agents SDK v1.4. One worker
31
+ process per LiveKit Cloud agent; one `AgentSession` per call.
32
+
33
+ ## Key files / entry points
34
+
35
+ | File | Purpose |
36
+ |---|---|
37
+ | `clients/odp/agent.py` | Worker bootstrap: `prewarm`, `entrypoint`, plugin wiring (lines ~115, 162–222) |
38
+ | `clients/odp/agents/tech_support.py` | `TalosAgent(Agent)` subclass — tools, greeting, userdata shape |
39
+ | `clients/odp/livekit.toml` | `project.subdomain`, `agent.id` for LiveKit Cloud |
40
+ | `clients/odp/Dockerfile` | Multi-stage uv build; bakes Silero + turn-detector weights at build time |
41
+ | `clients/odp/deploy.sh` | Copies `core/` into build context, syncs secrets, runs `lk agent deploy` |
42
+ | `core/services/egress.py` | Starts `RoomCompositeEgress` → S3 .ogg; polls stop |
43
+ | `core/services/knowledge_base.py` | Async wrapper around Bedrock `retrieve()` with TTL cache |
44
+
45
+ ## How it works
46
+
47
+ ### Worker lifecycle
48
+
49
+ ```
50
+ WorkerOptions(prewarm, entrypoint)
51
+ └─ prewarm: load Silero VAD model into shared process state
52
+ └─ entrypoint(JobContext):
53
+ ctx.connect()
54
+ derive callback_number/interaction_id from room name pattern
55
+ "call-_+<E164>_..."
56
+ AgentSession[CallUserdata](stt=…, llm=…, tts=…, vad=…, …)
57
+ session.start(room=ctx.room, agent=TalosAgent(...))
58
+ fire fetch_recent_tickets(callback_number) ← Agilant Ticket API
59
+ await session.say(greeting)
60
+ ```
61
+
62
+ ### Plugin wiring (agent.py)
63
+
64
+ | Stage | Plugin |
65
+ |---|---|
66
+ | **STT** | `aws.STT(language="en-US")` × 2 inside a `FallbackAdapter`. Transcribe disconnects after 15 s of silence; the fallback keeps the call alive. |
67
+ | **LLM** | `aws.LLM(model=BEDROCK_HAIKU, temperature=0.4, max_tokens=300)` primary; `aws.LLM(model=BEDROCK_SONNET, …)` fallback. Both inside `FallbackAdapter`. |
68
+ | **TTS** | `aws.TTS(voice="Matthew", engine="generative")` with **preemptive generation** for lower TTFB. |
69
+ | **VAD** | `silero.VAD.load()` in `prewarm` (shared across jobs in the worker). |
70
+ | **Turn detection** | LiveKit `MultilingualModel()` — endpointing 0.5–0.8 s; interruption threshold 1 word. |
71
+ | **Noise suppression** | `livekit-plugins-noise-cancellation` (`BVCTelephony` profile for SIP calls). |
72
+
73
+ ### Agent class
74
+
75
+ `TalosAgent` (`agents/tech_support.py`):
76
+
77
+ - Inherits `livekit.agents.Agent`.
78
+ - `instructions` = full system prompt loaded from `prompts.py`.
79
+ - `on_enter()` plays greeting + fires KB warmup.
80
+ - Tools (`@function_tool`):
81
+ - `set_caller_info(name, store_id, phone, workorder)` — incremental
82
+ update, called per field as provided.
83
+ - `search_knowledge_base(query)` — Bedrock KB lookup, `kb_max_results`
84
+ from config.
85
+ - `upsert_ticket_context(subject, summary, steps_tried, notes, priority)`
86
+ — populates `userdata` for end-of-call ticket creation.
87
+ - `link_existing_ticket(ticket_number, additional_notes)` — repeat
88
+ caller path; updates instead of creating.
89
+ - `mark_caller_as_customer()` — flag misrouted retail customer; short
90
+ flow.
91
+ - `end_call(farewell)` — speak goodbye then close room gracefully.
92
+
93
+ ### Userdata
94
+
95
+ `CallUserdata` dataclass holds session-scoped state: `callback_number`,
96
+ `interaction_id`, `session_id`, `recent_tickets` (populated by background
97
+ `fetch_recent_tickets`), `caller_info`, `ticket_context`, `existing_ticket`,
98
+ `is_customer_misroute`. Lives on `session.userdata` and is consumed by the
99
+ post-call writer (see `post-call-lambda.md`).
100
+
101
+ ### Audio recording (egress)
102
+
103
+ `core/services/egress.py` starts a `RoomCompositeEgress` at session start
104
+ writing to `s3://talos-voice-to-voice/odp/upload/raw/<session_id>.ogg`. At
105
+ end-of-call `s3_upload.py` moves the staged `.ogg` into the ticket folder
106
+ `odp/upload/<ticketNo>_<sessionId>_<refId>/call_recording.ogg`, then deletes
107
+ the staging file.
108
+
109
+ ### Knowledge base
110
+
111
+ `core/services/knowledge_base.py` wraps Bedrock `retrieve()` with an
112
+ in-process TTL cache (`kb_cache_ttl_seconds`, `kb_cache_max_entries` from
113
+ config). Cache key is the query string. The agent's `search_knowledge_base`
114
+ tool consults this.
115
+
116
+ ## Data model
117
+
118
+ No DB. Per-call state: `session.userdata` (in memory). Persisted state: the
119
+ S3 ticket folder + the Agilant Ticket API ticket record.
120
+
121
+ ## Client variations
122
+
123
+ `config.yaml` is the seam. Per-client overrides: `client_id`, `client_name`,
124
+ `agent_name`, `s3_upload_prefix`, `tts_voice`, `llm_max_tokens`,
125
+ `kb_max_results`, `timezone`. `prompts.py` is per-client. `core/` is shared.
126
+
127
+ ## Gotchas / known issues
128
+
129
+ - **Transcribe 15 s idle timeout** drops the connection silently — only the
130
+ `FallbackAdapter` saves the call. Do not collapse it to a single
131
+ `aws.STT(...)`.
132
+ - **`deploy.sh` MUST copy `core/` into the client folder** before
133
+ `lk agent deploy`; otherwise import errors at boot. Most common deploy
134
+ fail.
135
+ - **Silero weights are baked at build time.** If the upstream URL changes,
136
+ the build breaks. Pin a known-good `livekit-plugins-silero` version.
137
+ - **Polly generative TTS** is region-restricted. Stay in `us-east-1`
138
+ unless you check availability.
139
+ - **Room name parsing** for caller phone is regex-based on
140
+ `call-_+<E164>_...` — if LiveKit changes its SIP room naming, identity
141
+ lookup silently breaks. Guard with a sanity check in `entrypoint`.
142
+ - **`asyncio.CancelledError` on user hangup** must propagate out of tools
143
+ without writing partial state — `userdata` is the source of truth for the
144
+ post-call ticket; partial writes leak.
145
+
146
+ ## Change history
147
+ - 2026-06-16 — Initial LiveKit pipeline feature doc. (akhokhani)