Unified Agent execution

Engineering design for the public Agent and Context interfaces and the production ChatAgent subtype. Existing model loops, permissions, durable execution ownership and storage are reused.

Contract

OwnerResponsibility
AgentConfigured calls and persistent turns, asynchronous cancellation, event delivery, continuation entry and profile resolution.
ContextExplicit session writer and branch, named content, providers and history selection. Content never grants authority.
ChatAgentConversation defaults and the actual production chat entry, implemented through Agent.
Shared turn runtimeAdmission, model/tool execution, compression, streaming, persistence and finalization. The old dispatcher is an import compatibility adapter.
Execution controlExisting durable attempt ownership, pause, steering and checkpoint resume. No parallel job registry.

Boundaries

A conversation retains its session graph across turns. Plain helpers add no DAG nodes. Nested Agents retain independent graphs. Context blocks remain user content. Permission, memory and sandbox restrictions still apply. Tool timeout produces a tool error without cancelling its parent turn. User cancellation propagates to active work. Resume reuses persisted model context and does not repeat user admission.

Migration and acceptance

  1. Add public tests for Agent session turns, Context content/history, separate sessions, events and cancellation.
  2. Expose the shared turn runtime through Agent, extend Context using the existing store and rendering mechanisms, and keep dispatcher import identity compatible.
  3. Introduce ChatAgent and route production fresh and resumed turns through the class; retain the established driver and checkpoint protocol.
  4. Verify real fake-provider chat and durable continuation, independent reviews, full Python/frontend/docs gates, then refresh the installed App.

No external model requests, new databases or UI redesign are required. Existing graph ownership is retained. Reference implementation: the repository's existing agent_loop, Context engine, production driver and turn pipeline; this change makes no external framework capability claims.

Implementation status

The code and public regression tests are present. Release acceptance includes independent reviews, full regression tests and installed-runtime checks.