Summary
PraisonAI Managed Agents integration validated end-to-end with 15 example scripts (14 individual + 1 all-in-one). Two bugs found and fixed during testing.
Bug Fixes
1. custom_tool_use_id field name (managed_agents.py:329)
File: praisonai/integrations/managed_agents.py
Root cause: Anthropic API expects custom_tool_use_id in user.custom_tool_result events, but we were sending tool_use_id.
Fix: Changed "tool_use_id" → "custom_tool_use_id" in _process_events().
2. update_agent missing version (managed_agents.py:460)
File: praisonai/integrations/managed_agents.py
Root cause: Agents.update() requires version kwarg, but update_agent() was not passing it.
Fix: Auto-inject self.agent_version when version not in kwargs.
3. from praisonai import ManagedAgent, ManagedConfig (__init__.py)
File: praisonai/__init__.py
Root cause: ManagedAgent/ManagedConfig were not in __all__ or __getattr__, so only from praisonai.integrations.managed_agents import ... worked.
Fix: Added lazy-loading entries to __all__ and __getattr__.
Validated Examples
All 15 scripts tested successfully with claude-haiku-4-5 (cheapest model):
| # |
Example |
Lines |
Status |
| 01 |
Create Agent |
15 |
✅ |
| 02 |
Create Environment |
17 |
✅ |
| 03 |
Create Session |
18 |
✅ |
| 04 |
Stream Response |
17 |
✅ |
| 05 |
Select Tools |
27 |
✅ |
| 06 |
Disable Tools |
25 |
✅ |
| 07 |
Custom Tools |
41 |
✅ (after fix) |
| 08 |
Update Agent |
22 |
✅ (after fix) |
| 09 |
List Sessions |
23 |
✅ |
| 10 |
Web Search |
17 |
✅ |
| 11 |
Multi-Turn |
25 |
✅ |
| 12 |
Environment Setup |
22 |
✅ |
| 13 |
Interrupt Session |
20 |
✅ |
| 14 |
Track Usage |
28 |
✅ |
| app |
All-in-one |
235 |
✅ |
Key Simplification: One-line Import
from praisonai import Agent, ManagedAgent, ManagedConfig
vs Anthropic raw:
from anthropic import Anthropic
client = Anthropic()
agent = client.beta.agents.create(...)
environment = client.beta.environments.create(...)
session = client.beta.sessions.create(...)
with client.beta.sessions.events.stream(session.id) as stream:
...
PraisonAI equivalent:
from praisonai import Agent, ManagedAgent, ManagedConfig
managed = ManagedAgent(config=ManagedConfig(name="My Agent", model="claude-haiku-4-5", system="..."))
agent = Agent(name="my-agent", backend=managed)
result = agent.start("Do something")
Line Count Comparison (Anthropic vs PraisonAI)
| File |
Anthropic |
PraisonAI |
Reduction |
| app.py (all-in-one) |
428 lines |
235 lines |
-45% |
| 04_stream_response |
59 lines |
17 lines |
-71% |
| 13_interrupt_session |
63 lines |
20 lines |
-68% |
| 10_web_search |
53 lines |
17 lines |
-68% |
Files
- Examples:
/Users/praison/managedagents/praison/ (01-14 + app.py)
- Bug fixes:
praisonai/integrations/managed_agents.py, praisonai/__init__.py
Summary
PraisonAI Managed Agents integration validated end-to-end with 15 example scripts (14 individual + 1 all-in-one). Two bugs found and fixed during testing.
Bug Fixes
1.
custom_tool_use_idfield name (managed_agents.py:329)File:
praisonai/integrations/managed_agents.pyRoot cause: Anthropic API expects
custom_tool_use_idinuser.custom_tool_resultevents, but we were sendingtool_use_id.Fix: Changed
"tool_use_id"→"custom_tool_use_id"in_process_events().2.
update_agentmissing version (managed_agents.py:460)File:
praisonai/integrations/managed_agents.pyRoot cause:
Agents.update()requiresversionkwarg, butupdate_agent()was not passing it.Fix: Auto-inject
self.agent_versionwhenversionnot in kwargs.3.
from praisonai import ManagedAgent, ManagedConfig(__init__.py)File:
praisonai/__init__.pyRoot cause:
ManagedAgent/ManagedConfigwere not in__all__or__getattr__, so onlyfrom praisonai.integrations.managed_agents import ...worked.Fix: Added lazy-loading entries to
__all__and__getattr__.Validated Examples
All 15 scripts tested successfully with
claude-haiku-4-5(cheapest model):Key Simplification: One-line Import
vs Anthropic raw:
PraisonAI equivalent:
Line Count Comparison (Anthropic vs PraisonAI)
Files
/Users/praison/managedagents/praison/(01-14 + app.py)praisonai/integrations/managed_agents.py,praisonai/__init__.py