Web Chat ownership
The api/domains/web_chat/ domain owns dashboard chat requests, user-scoped thread history, and the authenticated SSE surface. It uses the Communications delivery pipeline and built-in Web Chat Connection. Reads require Agent activity permission; mutations require Agent update permission. This is distinct from external provider webhook authentication and runtime protocol credentials.
- 01.1
See
/guides/agents/web-chatfor permissions and thread behavior.
Layering
The default dependency direction is routes to services to repositories to the shared PostgreSQL delegate, with services also calling external adapters. Routes authenticate, parse, delegate, and return. Services own business rules and error translation. Repositories own SQL and tenant-aware query composition.
- 02.1
The three composition roots are
api/api_app.pyfor the Product API,api/ingest_app.pyfor Ingest, andapi/communications_app.pyfor Communications. - 02.2
User-facing Communication Connection management follows the same Product API layering rules. Platform Plugin behavior lives under
api/domains/communications/plugins/, while provider HTTP clients and other external mechanisms remain infrastructure concerns. Platform Plugins do not belong in Agent Runtime builders or Product API routes. See/guides/develop/add-platformfor the focused Platform Plugin guide. - 02.3
Product API:
/api/v1on port8000: authenticated product, Organization, Agent, Connection-management, Template, Skill, activity, and Platform administration routes. - 02.4
Ingest API:
/ingest/v1on port8001: Agent Runtime Tool Call and Tool Result telemetry. - 02.5
Communications application:
/communications/v1on port8002: Runtime Delivery protocol, Platform Driver callbacks, provider webhooks, supervised ingress, and outbound Delivery.
Tenancy and authorization
Organization routes carry the Organization ID and require a real persisted Membership. Platform routes use the Platform Administrator boundary and resolve no active Organization. Agent visibility is applied before count and pagination, while services check the caller’s effective Agent action Permissions. Inaccessible and cross-Organization Agent resources are normally concealed with 404; a visible resource lacking the required action returns 403.
- 03.1
Runtime Ingest, the Runtime Communications protocol, Platform Driver callbacks, and provider webhooks are separate non-user boundaries. They do not use an ordinary user session or receive implicit Organization authority. Provider webhook authentication is provider-specific and delegated to the selected Platform Plugin.
- 03.2
Agent-subordinate Communication Connections use Product API routes such as
/api/v1/organizations/{organization_id}/communication-platforms,/api/v1/organizations/{organization_id}/agents/{agent_id}/connections,/api/v1/organizations/{organization_id}/agents/{agent_id}/connections/{connection_id}, and the correspondingsummaryandjournalroutes. Connections are subordinate to an Agent, so every query and mutation validates Organization, Agent, and Connection ownership together. - 03.3
Agent Access governs visibility and ordinary Connection actions. Credential creation, replacement, and retirement also require secret-management authority; Connection credentials are encrypted separately from Agent Secrets and omitted from read responses. Connection identity remains present in diagnostics, directory, journal, reconnect, retry, and Delivery operations.
- 03.4
The Communications application serves non-user routes including
/communications/v1/agents/{agent_id}/deliveries/claim, Delivery reply and completion routes,/communications/v1/connections/{connection_id}/events, and/communications/v1/webhooks/{connection_id}. These are not Product API shortcuts: they use Runtime, driver, or provider-specific authentication, and a Runtime reply remains bound to the Delivery, Connection, and Conversation that produced the work. - 03.5
Skills use three Product API scopes. Platform routes use
/api/v1/platform/skillswith Platform Administrator authority; Organization routes use/api/v1/organizations/{organization_id}/skillswith Membership and Organization Skill Permissions; Agent-private routes use/api/v1/organizations/{organization_id}/agents/{agent_id}/skillswith Agent Access Permissions. Agent-private Skills retain both identities, never expose another Agent’s private lineage, and keep list, detail, draft, publish, version, fork, source-update, and deletion within the owning scope. Agents and Templates pin exact immutable Skill Versions. - 03.6
Product API user request: current authenticated user, scoped Organization Membership and Permission, and Agent Access where applicable.
- 03.7
Platform administration request: Platform Administrator authority with no active Organization.
- 03.8
Runtime Ingest: per-Agent Ingest identity; Tool Call telemetry only, never canonical Conversation Messages.
- 03.9
Runtime Communications protocol: per-Agent Communications bearer identity and the supported protocol-version header.
- 03.10
Platform Driver callback: per-Connection driver identity and the supported driver-version header.
- 03.11
Provider webhook: Connection-scoped authentication delegated to the selected Platform Plugin.
Transactions and Domain Events
The shared delegate commits per operation, so several repository calls are not automatically atomic. Workflows requiring all-or-nothing behavior need an explicit transaction. Event-producing repositories commit business state, one Outbox Message, and intended Event Deliveries in one session.
- 04.1
The Communications operation journal is not a Domain Event Outbox or Event Delivery log. Domain Events record selected immutable business facts; the Communications journal records provider ingress, policy, Delivery, retry, reconnect, and failure operations. See
/guides/domain-events-and-deliveryand/guides/observe-and-govern/communication-diagnosticsfor the detailed boundaries.
Startup, schema, and tests
Product API startup ensures the bootstrap Platform Administrator, publishes missing isolated bundled Skills into the global Platform Skill catalogue, and seeds missing predefined Platform Templates. Existing database-owned Platform resources remain canonical after bootstrap.
- 05.1
Schema changes require
Alembicmigrations. Integration tests use the realFastAPIapp and migrated PostgreSQL with additive dependency overrides. - 05.2
Communications changes also require focused Platform Plugin, gateway, Connection-isolation, and Runtime protocol coverage. A new Agent-subordinate route must prove Agent Access and cross-Organization concealment. See
/guides/testing-and-verificationand/guides/develop/testingfor coverage selection.
Agent Template references
A non-deleted Agent selects exactly one published configuration version, and that selection can reference one of three sources.
- 06.1
The Agent table’s CHECK constraint requires exactly one of these fields to be non-null while
deleted_atis null. - 06.2
Soft-deleted Agents can retain historical pins or be detached when an old shared lineage is purged. The active three-source constraint does not require immediate clearing of all pins on deletion.
- 06.3
An Override draft is not a published version and cannot be used as the Agent’s active selection. Publishing a new version does not automatically move an existing Agent to it. See
/guides/templates-versions-and-skillsfor the authoring and selection model. - 06.4
platform_template_id: a Platform Template Version. - 06.5
agent_template_id: an Organization Template Version. - 06.6
agent_template_override_version_id: a published Agent Template Override Version belonging to that Agent.