Skip to main content

FreePalestine.Dev image

PyPI - Version CI License

AgentHelm

Production-Ready Orchestration for AI Agents

AgentHelm is a lightweight Python framework for building AI agents with a focus on production-readiness. Built on DSPy, it provides plan-driven execution, full observability, and transactional safety guarantees.


✨ Key Features

🧠 DSPy-Native Agents

import dspy
from agenthelm import ToolAgent, tool

@tool()
def search(query: str) -> str:
    """Search the web."""
    return f"Results for: {query}"


lm = dspy.LM("mistral/mistral-large-latest")
agent = ToolAgent(name="researcher", lm=lm, tools=[search])
result = agent.run("Find AI news")

📋 Plan-Driven Execution

# Generate a multi-step plan
agenthelm plan "Build a web scraper" -o plan.yaml

# Review and execute
agenthelm execute plan.yaml

🔍 Full Observability

# View execution traces
agenthelm traces list

# Filter and export
agenthelm traces filter --status failed
agenthelm traces export -o report.md -f md

🔗 MCP Protocol Support

# Connect to MCP servers
agenthelm mcp list-tools uvx mcp-server-time
agenthelm mcp run uvx mcp-server-time -t "What time is it?"

🛡️ Transactional Safety

@tool(compensating_tool="reverse_payment")
def process_payment(amount: float) -> dict:
    """Process payment - rolls back on failure."""
    return payment_api.charge(amount)


@tool(requires_approval=True)
def delete_data(id: str) -> bool:
    """Dangerous operation - requires approval."""
    return db.delete(id)

🚀 Quick Start

Installation

pip install agenthelm

CLI

# Initialize configuration
agenthelm init

# Run a simple task
agenthelm run "What is 2+2?"

# Interactive chat
agenthelm chat

# Generate and execute plans
agenthelm plan "Build a calculator" -o plan.yaml
agenthelm execute plan.yaml

Python SDK

import dspy
from agenthelm import ToolAgent, tool, ExecutionTracer
from agenthelm.core.storage import SqliteStorage

@tool()
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b


# Create agent with tracing
lm = dspy.LM("mistral/mistral-large-latest")
tracer = ExecutionTracer(storage=SqliteStorage("traces.db"))

agent = ToolAgent(
    name="calculator",
    lm=lm,
    tools=[add],
    tracer=tracer,
)

result = agent.run("What is 15 + 27?")
print(result.answer)  # "42"
print(f"Cost: ${result.total_cost_usd:.4f}")

📦 What's Included

Component Description
ToolAgent ReAct-style agent with tool execution
PlannerAgent LLM-backed multi-step planning
Orchestrator DAG execution with parallel steps
ExecutionTracer Full observability with storage backends
MCPToolAdapter Model Context Protocol integration
MemoryHub Short-term and semantic memory
@tool decorator Approval, retries, compensation, timeout
CLI run, plan, execute, chat, traces, mcp
OpenTelemetry/Jaeger Distributed tracing support

🔧 CLI Commands

Command Description
agenthelm run "task" Execute a task with ToolAgent
agenthelm plan "task" Generate an execution plan
agenthelm execute file Run a plan from YAML
agenthelm chat Interactive REPL mode
agenthelm traces list View execution traces
agenthelm traces export Export to JSON/CSV/Markdown
agenthelm mcp list-tools List MCP server tools
agenthelm config set Configure settings

📊 Observability

Trace Storage

Traces are automatically saved to ~/.agenthelm/traces.db:

# Custom storage path
agenthelm run "task" -s ./my_traces.db

# View traces
agenthelm traces list
agenthelm traces show 0

# Filter and export
agenthelm traces filter --tool search --status success
agenthelm traces export -o report.md -f md

OpenTelemetry / Jaeger

# Start Jaeger
docker run -d -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one

# Run with tracing
agenthelm run "task" --trace

# View in Jaeger UI: http://localhost:16686

🏗️ Architecture

graph TD
    A[Task] --> B[PlannerAgent]
    B --> C[Plan with Steps]
    C --> D[Orchestrator]
    D --> E[ToolAgent 1]
    D --> F[ToolAgent 2]
    E --> G[Tool Execution]
    F --> G
    G --> H[ExecutionTracer]
    H --> I[Storage Backend]

Key Components

  1. PlannerAgent - Generates multi-step plans from natural language
  2. Orchestrator - Executes plans with parallel steps and Saga rollback
  3. ToolAgent - ReAct reasoning loop with tool execution
  4. ExecutionTracer - Captures every decision for observability
  5. MCPClient - Connects to external MCP servers

📚 Documentation

📖 Full Documentation: https://hadywalied.github.io/agenthelm/


🗺️ Roadmap

✅ v0.3.0 (Current)

  • DSPy-native agents (ToolAgent, PlannerAgent)
  • Plan-driven execution with YAML export
  • Multi-agent orchestration with Saga pattern
  • MCP protocol integration
  • Full CLI with traces, chat, execute
  • OpenTelemetry/Jaeger support
  • Cost and token tracking

🔜 v0.4.0 (Planned)

  • Budget enforcement (tokens, time, I/O)
  • Checkpointing for resumable workflows
  • Policy engine for constraints
  • Web dashboard for trace visualization

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

  • 🐛 Bug reports
  • 💡 Feature requests
  • 📖 Documentation improvements
  • 🔧 Code contributions

📄 License

MIT License - see LICENSE file for details.



⭐ Star us on GitHub if AgentHelm helps you build production-ready agents!

Metadata

Release files for agenthelm 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agenthelm 0.3.0
File Size Uploaded
agenthelm-0.3.0.tar.gz 51.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agenthelm 0.3.0
File Interpreter ABI Platform
agenthelm-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 100.9 kB

Release files / agenthelm-0.3.0.tar.gz

Download URL agenthelm-0.3.0.tar.gz
Size 51.0 kB
Tags Source
SHA-256 checksum
How to use checksums
43f0d365843ce982f9f835de41ecab1081d52f676ec13b2d00e44b0e53848677
BLAKE2b-256 checksum
How to use checksums
a48a7ca573d8a5b395b8d802add34c5ad2b60652d2521931efce7d1226d779ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / agenthelm-0.3.0-py3-none-any.whl

Download URL agenthelm-0.3.0-py3-none-any.whl
Size 49.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0076c9c60476bb373b4a1e69a428f1613fbe84a5b6a1ad10c2e1f33f0d5cbb8
BLAKE2b-256 checksum
How to use checksums
0f4f8bb522d01b36e015f95a35efa8b082a0ce2f85afc8960c4e45623e75d735
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page