Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.fact0.io/llms.txt

Use this file to discover all available pages before exploring further.

OpenAI Agents SDK

A dedicated wrapper is on the roadmap. The pattern below uses the public hooks available today.

Pattern

Run the agent inside a telemetry execution and add spans around each tool call.
import fact0
from agents import Agent, Runner

client = fact0.Client(api_key="alk_live_...")

agent = Agent(name="support", instructions="...", tools=[...])

with client.telemetry.execution(agent_id="support-bot") as ex:
    with ex.span("agent.run", span_type="MODEL_INVOCATION") as span:
        result = Runner.run_sync(agent, input="Refund order #123")
        span.complete(output={"final": result.final_output})

Tool call detail

Subclass or wrap each function_tool to push a TOOL_CALL span:
@function_tool
def lookup_order(order_id: str):
    with client.telemetry.current_execution().span(
        "lookup_order", span_type="TOOL_CALL"
    ) as span:
        order = db.get(order_id)
        span.complete(output={"status": order.status})
        return order