Skip to content

[FEATURE]: Separate an agent's configuration from its running state #628

Description

@jakedipity

Summary

Agent holds config-derived values — model, turn depth, system prompt, context window — alongside state belonging to a single run, such as its scratchpad budget and turn-nudge state, and the whole thing is constructed fresh for every chat request. Separating the two is what makes an agent something that can be reused rather than rebuilt, and it is the delineation between AgentConfig and a running Agent that #575 asks for.

The reusable half is built rather than declared — it owns a live provider client, the tools discovered at build time, and open MCP connections — so PreparedAgent names it and Agent keeps meaning one run. That leaves AgentRuntimeConfig unambiguously the TOML.

Goals

  • The config-derived half constructible once and shareable across a session's turns.
  • The per-run half owned by one run and dropped with it, including the state that reaches tools through wrappers rather than through a field.
  • No change in behavior, so it can land without a flag or a migration.
  • The precondition satisfied for warm agent and MCP reuse in [FEATURE]: Session Backed Agent Runtime #578, without implementing caching here.

Additional Context

A prepared agent serves one run at a time. Rig owns its tool server at agent scope — tool_server_handle is a field on rig's Agent, spawned once when the agent is built — so every tool call for that agent arrives on one long-lived task. Two runs sharing a prepared agent would have no way to tell their tool calls apart: the task-local run scope does not survive the spawn, and a single bound-run slot races. Concurrency belongs at the session level, one prepared agent per session.

Worth enforcing rather than documenting alone, because the failure is silent — tool events attributed to the wrong run, no error. Lifting the restriction means per-call run correlation, which rig's design does not currently allow.

Ordering: this rewrites the Agent struct, which the #575 event stack also modifies, so it wants to land after that stack rather than under it.

Searched Issues

  • No similar issues found

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added 10 commits that reference this issue on Sep 24, 2026
    7205594
    e04038f
    aa84e50
    a44af75
    a9a6776
    99e1f78
    04074b9
    fe87379
    f9bb190
    513f1ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions