Skip to main content
Managed backend plugins let third-party packages register new HostedAgent(provider=...) runtimes — like e2b, modal, or flyio — without editing PraisonAI core.
The user installs a plugin entry point; HostedAgent resolves the provider and runs the agent on that backend.

Quick Start

1

Simple — Programmatic Registration

Register a backend class directly at runtime (ideal for testing or single-project use):
2

With Entry Point — pip-installable Plugin

Create a Python package with a praisonai.managed_backends entry point so your backend is automatically available after pip install:
After installation:

How It Works

HostedAgent.__new__ acts as a factory for non-Anthropic backends. When the resolved backend class is different from HostedAgent, Python’s __new__ returns the backend instance directly — __init__ is skipped. Callers receive the real backend’s methods without any AnthropicManagedAgent-inherited state:
The builtin anthropic backend is pre-registered in ManagedBackendRegistry — it resolves to AnthropicManagedAgent. Async parity. When an agent with a managed backend calls achat() / astart() / arun(), the backend’s async execute() is awaited directly through _adelegate_to_backend — no worker-thread bridge, and the same rate limiter and cancellation token that gate the sync path apply first. Session history is recorded identically on both paths, so switching an agent between sync and async does not diverge its chat_history. Before PR #3877 a configured backend was silently ignored on async entry points and calls fell through to direct-LLM.

Configuration Options

ManagedBackendRegistry API Reference

Complete API reference for ManagedBackendRegistry

Common Patterns

Custom Hosted Runtime

Selecting Between Multiple Registered Backends

Graceful Unavailable-Backend Handling


Best Practices

Use the provider name as the entry-point key — lowercase, no hyphens. The key becomes the value passed to provider=:
Always implement is_available() with a fast, cached check. The registry calls it during startup probing:
Never do heavy imports inside is_available() — it is called on every registry probe.
Include helpful hints in your error messages so users know what to install:
Implement resource cleanup if your backend opens connections or sandbox environments:

Framework Adapter Plugins

Add new execution frameworks via entry points

Hosted Agent

Run agent loops on managed cloud runtimes