General
PromptBeginner5 minmarkdown
<h1 align="center">
<a href="https://prompts.chat">
5
A production-ready callback agent framework built on the Claude Agent SDK, enabling event-driven agent orchestration with lifecycle hooks, agent chaining, and async callbacks.
Sign in to like and favorite skills
A production-ready callback agent framework built on the Claude Agent SDK, enabling event-driven agent orchestration with lifecycle hooks, agent chaining, and async callbacks.
This project extends the Claude Agent SDK to provide:
# Install uv add callback-agents # Basic usage from callback_agents import CallbackAgent, on_complete @on_complete async def handle_result(agent_id: str, result: dict): print(f"Agent {agent_id} finished with: {result}") agent = CallbackAgent( prompt="Analyze this codebase", on_complete=handle_result ) await agent.run()
┌─────────────────────────────────────────────────────────────┐ │ CallbackAgent System │ ├─────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Agent A │───▶│ EventBus │───▶│ Agent B │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Hooks │ │ Callbacks │ │ Webhooks │ │ │ │ (SDK native)│ │ (custom) │ │ (external) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘
agent = CallbackAgent( prompt="...", on_start=lambda: print("Started"), on_complete=lambda result: print(f"Done: {result}"), on_error=lambda e: print(f"Error: {e}"), on_tool_use=lambda tool, input: print(f"Using {tool}") )
chain = AgentChain([ ("analyzer", "Analyze the codebase structure"), ("reviewer", "Review code quality based on analysis"), ("reporter", "Generate report from review") ]) final_result = await chain.run()
agent = CallbackAgent( prompt="...", webhooks={ "on_complete": "https://api.example.com/agent-complete", "on_error": "https://api.example.com/agent-error" } )
from callback_agents import RedisEventBus bus = RedisEventBus("redis://localhost:6379") bus.subscribe("agent:complete", handle_completion) agent = CallbackAgent(prompt="...", event_bus=bus)
MIT