You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The canonical managed-agents backend contract lives at src/praisonai-agents/praisonaiagents/agent/protocols.py:306-445, but the namespace a user would look in — praisonaiagents.managed.protocols — only exposes ComputeProviderProtocol (compute layer). Result:
frompraisonaiagents.managedimportManagedBackendProtocol# AttributeError# vsfrompraisonaiagents.agent.protocolsimportManagedBackendProtocol# works
This violates the principle that related protocols live together in the module namespace named after the feature.
A6 — retrieve_session() schema drift
AnthropicManagedAgent.retrieve_session (managed_agents.py:511-527) returns {id, status, usage: {input_tokens, output_tokens}} (sometimes no usage key). LocalManagedAgent.retrieve_session (managed_local.py:673-683) returns {id, status, usage: {input_tokens, output_tokens}} always. Both also have inconsistent handling of the title field.
Cross-provider code that reads info["title"] or info["usage"] without defaults breaks silently.
Acceptance criteria
from praisonaiagents.managed import ManagedBackendProtocol works (re-export only, no move, no breaking change).
praisonaiagents.managed.__all__ includes ManagedBackendProtocol.
Both retrieve_session() implementations return this dataclass (or its .to_dict() for back-compat); docstring documents the schema.
Back-compat: old dict keys still present.
Tests assert schema equality between Anthropic and Local return values.
Implementation plan
Edit src/praisonai-agents/praisonaiagents/managed/__init__.py to lazy-export ManagedBackendProtocol via __getattr__ (no eager import to keep module light).
Add src/praisonai/praisonai/integrations/_session_info.py with the SessionInfo dataclass + to_dict() for back-compat.
Update both retrieve_session() methods to build and return SessionInfo.
Problem
Two discoverability / consistency gaps.
A1 —
ManagedBackendProtocolhiddenThe canonical managed-agents backend contract lives at
src/praisonai-agents/praisonaiagents/agent/protocols.py:306-445, but the namespace a user would look in —praisonaiagents.managed.protocols— only exposesComputeProviderProtocol(compute layer). Result:This violates the principle that related protocols live together in the module namespace named after the feature.
A6 —
retrieve_session()schema driftAnthropicManagedAgent.retrieve_session(managed_agents.py:511-527) returns{id, status, usage: {input_tokens, output_tokens}}(sometimes nousagekey).LocalManagedAgent.retrieve_session(managed_local.py:673-683) returns{id, status, usage: {input_tokens, output_tokens}}always. Both also have inconsistent handling of thetitlefield.Cross-provider code that reads
info["title"]orinfo["usage"]without defaults breaks silently.Acceptance criteria
from praisonaiagents.managed import ManagedBackendProtocolworks (re-export only, no move, no breaking change).praisonaiagents.managed.__all__includesManagedBackendProtocol.SessionInfodataclass (wrapper-side):{id: str, status: str, title: str, usage: {input_tokens: int, output_tokens: int}}— all fields always present (defaults:"","unknown","",{0,0}).retrieve_session()implementations return this dataclass (or its.to_dict()for back-compat); docstring documents the schema.AnthropicandLocalreturn values.Implementation plan
src/praisonai-agents/praisonaiagents/managed/__init__.pyto lazy-exportManagedBackendProtocolvia__getattr__(no eager import to keep module light).src/praisonai/praisonai/integrations/_session_info.pywith theSessionInfodataclass +to_dict()for back-compat.retrieve_session()methods to build and returnSessionInfo.Files
Modify:
src/praisonai-agents/praisonaiagents/managed/__init__.pysrc/praisonai/praisonai/integrations/managed_agents.pysrc/praisonai/praisonai/integrations/managed_local.pyCreate:
src/praisonai/praisonai/integrations/_session_info.pysrc/praisonai-agents/tests/managed/test_session_info_schema.pyInvariants
References
ManagedBackendProtocoldefinition:praisonaiagents/agent/protocols.py:306.cc @claude.