A lightweight, production-ready framework for building hybrid agentic systems with structured logging, process-isolated execution, and self-healing capabilities.
- 🔧 Structured Logging - Correlation IDs and centralized logging across all components
- ⚡ Async/Sync Execution - Full asyncio support with sync wrappers for Jupyter
- 🛡️ Process-Isolated Sandbox - Safe code execution with deterministic termination
- 🔄 Parallel Tool Execution - Concurrent tool calls with semaphore-based concurrency
- 📊 OpenTelemetry Integration - Optional observability with automatic spans
- ⚙️ Self-Healing Runtime - Adaptive error handling with automatic tool patching
- 🧪 Production Ready - 87% test coverage with GitHub Actions CI/CD
import asyncio
from hybrid_agentic import Orchestrator, Agent
from hybrid_agentic.models.simple import SimpleModel
def add(a: int, b: int) -> int:
"""Add two numbers (example tool)."""
return a + b
agent = Agent(
model=SimpleModel(),
system_prompt="You are a helpful assistant that can perform calculations.",
tools=[add],
)
orch = Orchestrator(max_iterations=3)
async def main():
resp = await orch.run(agent, "What is 4 + 7?")
print(resp["content"])
asyncio.run(main())
# In Jupyter notebooks call run_sync safely:
# response = orch.run_sync(agent, "Hello") # works even with existing event looppip install hybrid-agentic
# Optional dependencies for enhanced features:
pip install "hybrid-agentic[vector]" # FAISS vector memory
pip install "hybrid-agentic[telemetry]" # OpenTelemetry tracingInstall OpenTelemetry for automatic span creation:
pip install opentelemetry-sdk opentelemetry-exporter-otlpSpans for model calls and tool executions will appear in your OTLP‑compatible backend (Jaeger, Honeycomb, etc.) without further code changes.
Enable lightweight self-healing by decorating tools and subscribing handlers:
from hybrid_agentic.utils.adapt import adaptive_tool, EventDispatcher
@adaptive_tool
def divide(x: float, y: float) -> float:
return x / y
def patch_zero_div(error_type: str):
if error_type == "ZeroDivisionError":
divide.__wrapped__ = lambda x, y: x / (y or 1) # type: ignore
EventDispatcher.subscribe("adaptation_needed", patch_zero_div)After three uncaught ZeroDivisionErrors the handler runs and patches the tool
globally—no restarts required.
The framework is built around these core components:
- Agent: Manages model interactions and tool execution
- Orchestrator: Coordinates agent workflows with parallel tool support
- Tool: Validated, executable functions with Pydantic schemas
- Sandbox: Process-isolated code execution environment
- Memory: Context management with optional vector storage
- v0.3.0-alpha (Current) - Core framework with logging, telemetry, and adaptive runtime
- v0.4.0 - Multi-agent orchestration and MCP protocol support
- v0.5.0 - A2A protocol integration and federation capabilities
Contributions welcome! Please see our Contributing Guide for details.
MIT License - see LICENSE for details.
Built with ❤️ for the agentic future