kcode-agent-runtime 0.1.1

Provider-neutral subagent loops over kcode-intelligence-router
Documentation
# kcode-agent-runtime

`kcode-agent-runtime` runs fresh-context, tool-using subagents through
`kcode-intelligence-router`. Applications supply context text and a small host
boundary for tool execution, projected state, audit records, and optional
freeform output capture.

The crate owns no provider clients, credentials, model catalog, receipt store,
Kmap data, journal, or application tool implementation.

`AgentRuntime::run` resolves the requested model through the router, enforces
the resolved input limit, starts each provider turn as a cancellable child of
the caller's operation, and presents every turn with a fresh rendering of:

1. the ordered immutable context;
2. the focused task;
3. compact tool-call and tool-result history; and
4. the latest replaceable host state.

The runtime owns the provider-neutral `call_ktool` declaration, strict tool
call parsing, context estimates, state replacement, rerender barriers,
freeform capture turns, the 100-round safety limit, and runtime-selected audit
events. `Host` owns only application-specific rendering, tool execution,
replaceable state returned by those tools, capture completion, and durable
recording.

The host receives a `ContextBudget` before each operation so it can reject a
write whose resulting current state would not fit. It returns `StateUpdate`
values keyed by stable application identities; a later update replaces the
earlier projection rather than duplicating it. A host may return an opaque
capture token when a tool needs the model's next complete tool-free answer,
such as a whole source file.