Skip to main content
Managed Agents run on cloud infrastructure, automatically provisioning compute resources and managing execution environments.

Quick Start

1

Basic Usage

from praisonaiagents import Agent
from praisonai.integrations.managed_agents import ManagedAgent

agent = Agent(name="teacher", backend=ManagedAgent())
result = agent.start("Write a Python script that prints Hello World and run it")
print(result)
2

With Configuration

from praisonaiagents import Agent
from praisonai.integrations.managed_agents import ManagedAgent, ManagedConfig

managed = ManagedAgent(
    config=ManagedConfig(
        model="claude-sonnet-4-6",
        system="You are a helpful assistant. Be concise.",
        name="MyAgent",
        packages={"pip": ["pandas", "numpy"]},
    )
)
agent = Agent(name="data-analyst", backend=managed)
result = agent.start("Analyze this data: [1,2,3,4,5]", stream=True)

How It Works

ComponentPurposeManaged By
Agent DefinitionModel, system prompt, toolsCloud Provider
EnvironmentCompute resources, packagesCloud Provider
SessionConversation context, stateCloud Provider
ExecutionCode running, tool usageCloud Provider

Compute Providers

Managed Agents support multiple compute providers for different use cases:

Local Provider

Run on local infrastructure with cloud management

Docker Compute

Containerized execution environments

E2B Cloud

Instant cloud sandboxes for code execution

Modal Compute

Serverless compute for scalable workloads

Daytona Workspaces

Development environments with persistent storage

Configuration Options

ManagedConfig API Reference

Complete configuration options for managed agents

Key Configuration Fields

OptionTypeDefaultDescription
modelstr"claude-haiku-4-5"LLM model to use
systemstr"You are a helpful coding assistant."System prompt
toolsList[Dict][{"type": "agent_toolset_20260401"}]Available tools
packagesDict[str, List[str]]NonePackage dependencies
networkingDict[str, Any]{"type": "unrestricted"}Network access policy

Common Patterns

Environment with Packages

from praisonaiagents import Agent
from praisonai.integrations.managed_agents import ManagedAgent, ManagedConfig

managed = ManagedAgent(
    config=ManagedConfig(
        model="claude-sonnet-4-6",
        packages={
            "pip": ["pandas", "matplotlib", "requests"],
            "npm": ["@types/node", "axios"]
        },
        networking={"type": "limited"}
    )
)
agent = Agent(name="data-scientist", backend=managed)

Session Persistence

# Save session state
managed = ManagedAgent(config=config)
agent = Agent(name="persistent", backend=managed)
agent.start("Remember: my favorite color is blue")
ids = managed.save_ids()

# Resume in another process
managed2 = ManagedAgent(config=config)
managed2.restore_ids(ids)
managed2.resume_session(ids["session_id"])
agent2 = Agent(name="resumed", backend=managed2)
result = agent2.start("What is my favorite color?")  # Knows: blue

Custom Tools

def handle_calculator(tool_name, tool_input):
    expr = tool_input.get("expression", "0")
    return str(eval(expr, {"__builtins__": {}}))

managed = ManagedAgent(
    config=ManagedConfig(
        tools=[{
            "type": "custom",
            "name": "calculator",
            "description": "Evaluate math expressions",
            "input_schema": {
                "type": "object",
                "properties": {"expression": {"type": "string"}},
                "required": ["expression"]
            }
        }]
    ),
    on_custom_tool=handle_calculator
)

Best Practices

  • Local: Development and testing with existing infrastructure
  • Docker: Isolated, reproducible environments
  • E2B: Quick prototyping and sandboxed execution
  • Modal: High-performance, scalable workloads
  • Daytona: Development environments with persistence
Save session IDs for resuming conversations across process restarts. Use save_ids() and restore_ids() to maintain context between runs.
Use networking: {"type": "limited"} for untrusted code execution. Enable only required packages to minimize attack surface.
Track token usage with retrieve_session() to monitor costs. Set appropriate timeouts for long-running operations.

Agents

Core agent concepts and configuration

Tools

Available tools and custom tool creation