원클릭으로
agent-callbacks
Add callbacks to orxhestra agents for logging, monitoring, and error handling. Covers model and tool callbacks.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Add callbacks to orxhestra agents for logging, monitoring, and error handling. Covers model and tool callbacks.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Build orxhestra agent trees from declarative YAML orx files. Covers full schema, models, tools, agents, runner, and server.
Expose orxhestra agents as A2A protocol endpoints or connect to remote A2A agents.
Add planners to orxhestra agents for structured reasoning. Covers BasePlanner, PlanReActPlanner, and TaskPlanner.
Add dynamic skills to orxhestra agents. Covers Skill, InMemorySkillStore, and skill discovery/loading tools.
Stream events from orxhestra agents including token-by-token output, sub-agent events via AgentTool, and Runner streaming.
Create and use tools with orxhestra agents. Covers function_tool, AgentTool, transfer tools, exit_loop, MCP tools, and CallContext.
| name | agent-callbacks |
| description | Add callbacks to orxhestra agents for logging, monitoring, and error handling. Covers model and tool callbacks. |
LlmAgent supports before/after hooks at the model and tool level.
from orxhestra import LlmAgent, Context
from orxhestra.models.llm_request import LlmRequest
from orxhestra.models.llm_response import LlmResponse
async def log_before_model(ctx: Context, request: LlmRequest) -> None:
print(f"Calling LLM with {len(request.messages)} messages")
print(f"Tools available: {[t.name for t in request.tools]}")
async def log_after_model(ctx: Context, response: LlmResponse) -> None:
print(f"LLM responded: {response.text[:100]}")
if response.has_tool_calls:
print(f"Tool calls: {[tc['name'] for tc in response.tool_calls]}")
async def handle_error(
ctx: Context, request: LlmRequest, error: Exception
) -> LlmResponse | None:
print(f"LLM error: {error}")
return None # push error event; or return LlmResponse to recover
agent = LlmAgent(
name="monitored",
model=model,
before_model_callback=log_before_model,
after_model_callback=log_after_model,
on_model_error_callback=handle_error,
)
from typing import Any
async def log_tool_start(ctx: Context, tool_name: str, tool_args: dict) -> None:
print(f"Calling tool: {tool_name}({tool_args})")
async def log_tool_end(ctx: Context, tool_name: str, result: Any) -> None:
print(f"Tool {tool_name} returned: {str(result)[:100]}")
agent = LlmAgent(
name="tracked",
model=model,
tools=[search],
before_tool_callback=log_tool_start,
after_tool_callback=log_tool_end,
)
Intercept events from child agents when using AgentTool.
from orxhestra.tools import AgentTool
def before_agent(ctx, agent):
print(f"Delegating to sub-agent: {agent.name}")
def after_agent(ctx, agent, events):
print(f"Sub-agent {agent.name} produced {len(events)} events")
tool = AgentTool(
agent=researcher,
before_agent_callback=before_agent,
after_agent_callback=after_agent,
)
from langfuse.callback import CallbackHandler
from orxhestra import AgentConfig
handler = CallbackHandler(public_key="...", secret_key="...", host="...")
config = AgentConfig(
configurable={"callbacks": [handler]},
)
async for event in agent.astream("Hello", config=config):
print(event)