The unified
retrieve_session() schema applies to both HostedAgent and LocalAgent (the new canonical classes), as well as the deprecated ManagedAgent factory.retrieve_session() returns the same shape on every managed agent backend so you can write code once and switch providers freely.
SessionInfo fields for tooling and dashboards.
How It Works
Quick Start
1
HostedAgent Usage
2
LocalAgent Usage
Schema
All four fields are always present with sensible defaults:Status Values
Empty Session Defaults
Before starting any turn you still get a valid dict — noKeyError, no .get() guards:
Building a Custom Backend
Import the protocol directly frompraisonaiagents.managed:
Common Patterns
Cost monitoring
Provider-agnostic logging
Best Practices
Don't guard with .get()
Don't guard with .get()
Every key is always present.
info["usage"]["input_tokens"] is always safe.Check status before sending
Check status before sending
Use
status == "idle" before sending a new message to avoid overlapping turns.Handle backend differences
Handle backend differences
LocalManagedAgent always returns title="". Only AnthropicManagedAgent sets it.Use stable import path
Use stable import path
from praisonaiagents.managed import ManagedBackendProtocol is the stable, recommended path.Related
Hosted Agent
Run entire agent loops on Anthropic’s managed runtime
Local Agent
Run agent loops locally with any LLM

