Runtime / Dynamic Configuration Changes
Configure and manage runtime changes to agent state through the AgentStateManager.
Complete Reference
For complete API documentation and event specifications, see agent.yml → Dynamic Changes.
Overview
AgentStateManager allows safe, validated modifications to the running configuration without restarting your agent.
Example – per-session LLM override
stateManager.updateLLM(
{ provider: 'openai', model: 'gpt-5', maxInputTokens: 50_000 },
'user-123'
);
Internally the manager:
- Validates the patch against
LLMConfigSchema. - Stores the override under
sessionOverrides. - Emits
state:changedandsession:override-setevents.
Example – add MCP server at runtime
await agent.addMcpServer('git', {
command: 'mcp-git',
args: ['--repo', process.cwd()]
});
This triggers mcp:server-added, after which MCPManager connects and refreshes its capability cache.
See Also
- agent.yml Reference → Dynamic Changes - Complete API documentation
- System Prompt Configuration - Static configuration
- MCP Configuration - MCP server setup