OpenAI Agents SDK
AxonPushRunHooks implements the OpenAI Agents JS RunHooks interface, agent starts and ends, tool calls, and handoffs.
AxonPushRunHooks implements the lifecycle-hook surface of the OpenAI Agents
JS SDK: onAgentStart, onAgentEnd, onToolStart, onToolEnd, and
onHandoff. Each hook publishes one axonpush event.
Tested against @openai/agents@^0.1.
Install
npm install @axonpush/sdk @openai/agents
Wire up the hooks
import { AxonPush, AxonPushRunHooks } from "@axonpush/sdk";
const client = new AxonPush();
const hooks = new AxonPushRunHooks({
client,
channelId: process.env.AXONPUSH_CHANNEL_ID!,
});
Pass the instance to the runner as hooks, or attach it per-agent through the
framework’s runHooks property:
const result = await Runner.run({ agent, input, hooks });
The class implements the framework’s RunHooks interface,
onAgentStart, onAgentEnd, onToolStart, onToolEnd, onHandoff, so
whichever of the two wiring points your @openai/agents version exposes will
accept it.
Agent attribution
Unlike the other integrations, agentId is not fixed per handler. Each event is
attributed to the agent the framework passed in, agent.name, so a multi-agent
run fans out across distinct agent ids in the UI without any configuration. The
agentId you supply in the config is only the fallback for when the framework
hands over an agent with no name; it defaults to "openai-agent".
Handoffs are attributed to the source agent, with the destination in the payload.
What gets emitted
| Identifier | axonpush eventType | Payload |
|---|---|---|
agent.run.start | agent.start | agent_name, model |
agent.run.end | agent.end | agent_name, output_length |
tool.{name}.start | agent.tool_call.start | tool_name, agent_name |
tool.{name}.end | agent.tool_call.end | tool_name, result_length |
agent.handoff | agent.handoff | from_agent, to_agent |
Tool results and agent outputs are recorded by length only, the content
itself never leaves your process through this integration. Every event carries
metadata.framework: "openai-agents".
All five hooks share one TraceContext for the life of the handler, so a whole
run, across every agent and handoff in it, reads as a single trace. Seed
traceId in the config to join a trace that started upstream.