ManagedBackendProtocol
Defined in the protocols module.AI Agent Protocol for external managed agent backends. Defines the contract between PraisonAI Agent’s delegation layer (
execution_mixin._delegate_to_backend) and any managed agent
infrastructure provider (Anthropic Managed Agents, etc.).
The Core SDK defines what — this protocol.
The Wrapper implements how — the provider-specific adapter.
Lifecycle::
backend = SomeManagedBackend(config={…})
agent = Agent(name=“coder”, backend=backend)
result = agent.start(“Write a script”) # delegates to backend.execute()
Implementations must handle:
- Agent/environment/session creation and caching
- Event streaming (agent.message, agent.tool_use, session.status_idle)
- Custom tool calls (agent.custom_tool_use → user.custom_tool_result)
- Tool confirmation (always_ask policy → user.tool_confirmation)
- Usage tracking (input_tokens, output_tokens)
- Session reset for multi-turn isolation
Methods
execute()
Execute a prompt on managed infrastructure and return the full response.
stream()
Stream a prompt response as text chunks.
reset_session()
Discard the cached session so the next execute() creates a fresh one.
reset_all()
Discard all cached state (agent, environment, session, client).
update_agent()
Update an existing managed agent’s configuration.
interrupt()
Send a user interrupt to the active session.
retrieve_session()
Retrieve the current managed session’s metadata and usage.
list_sessions()
List sessions for the current agent.
Source
View on GitHub
praisonaiagents/agent/protocols.py at line 325
