# Agent and Context contract

| Owner | Responsible for |
| --- | --- |
| `Agent` | Configured calls and persistent turns (`run_turn`, `resume_turn`, `arun_turn`, `aresume_turn`), cancellation, events, profile resolution (`from_spec`) |
| `Context` | Session writer and branch, named content, providers, history selection (`None`, `"thread"`, `"chat"` or a callable) |
| `ChatAgent` | Conversation defaults; the production chat entry, through `Agent` |
| Shared turn runtime | Admission, model and tool execution, compression, streaming, persistence, finalization. `dispatcher` is an import alias for it. |
| Execution control | Durable attempt ownership, pause, steering, checkpoint resume. No parallel job registry. |

## Boundaries

| Case | Behaviour |
| --- | --- |
| Conversation | Keeps its session graph across turns |
| Plain helper | Adds no DAG nodes |
| Nested Agent | Keeps an independent graph |
| Context content | Stays user content: never grants authority; permission, memory and sandbox limits still apply |
| Tool timeout | A tool error; the parent turn continues |
| User cancellation | Reaches all active work |
| Resume | Reuses persisted model context, repeats no user admission |

## Implementation status

Code and public regression tests are present.

[Agent execution core](https://fzkuji.github.io/OpenProgram/docs/reference/design/runtime/agent/llm-and-agent.html)
