Skip to main content
You use the OpenAI Agents SDK. You want agent steps and tool calls tracked inside Apie runs with minimal wiring. Create Apie run hooks and pass them to your agent run:
import { createApieRunHooks } from "@apie-sh/sdk/integrations";
import apie from "./apie.config";

const hooks = createApieRunHooks(apie);

await apie.withRun({ inputSummary: "OpenAI Agents run" }, async () => {
  const result = await run(agent, input, { hooks });
});
Hooks track agent lifecycle events, tool calls, and errors inside the active run.

Agent step wrapper

Wrap individual agent steps with explicit metadata:
import { withOpenAIAgentStep } from "@apie-sh/sdk/integrations";

await withOpenAIAgentStep(
  apie,
  {
    runId: run.id,
    stepKey: "plan",
    stepName: "Planning step",
    stepIndex: 0,
  },
  async () => agent.plan(input),
);

Tool call wrapper

For individual tool calls with guard metadata:
import { withOpenAIAgentToolCall } from "@apie-sh/sdk/integrations";

await withOpenAIAgentToolCall(
  apie,
  {
    runId: run.id,
    toolName: "search",
    arguments: { query: "billing issue" },
    resourceType: "knowledge_base",
    riskLevel: "low",
  },
  async () => search("billing issue"),
);

What you’ll see

Agent steps and tool calls in the run timeline with workflow and tool events.

Example

Next steps

LLM tool calls

OpenAI native tool call wrappers.

Integrations hub

All framework integrations.