Skip to content

@trace

@trace(name=None, metadata=None, auto_open=True)
ParameterTypeDefaultDescription
namestrNoneRun name displayed in the UI timeline
metadatadictNoneArbitrary data attached to the trace JSON
auto_openboolTrueWhether to automatically start the UI server on trace completion
from openjck import trace
@trace
def my_agent():
# agent logic here
pass
from openjck import trace
@trace(name="research_agent")
def research_agent(task):
# agent logic here
pass
from openjck import trace
@trace(
name="customer_support_bot",
metadata={"version": "1.2.0", "user_id": "user_123"}
)
def support_agent(query):
# agent logic here
pass
from openjck import trace
import asyncio
@trace(name="async_agent")
async def async_agent(task):
# async agent logic here
pass

The @trace decorator captures:

  • Run name (from name parameter or function name)
  • All steps executed within the decorated function
  • Total token count and estimated cost
  • Overall duration and status (completed/failed)
  • Any uncaught exceptions that occur during execution

Traces are saved as JSON files in ~/.openjck/traces/<trace_id>.json where <trace_id> is a unique identifier for each run.

When a traced function completes, OpenJCK prints a summary to the terminal:

[OpenJCK] Run complete → COMPLETED
[OpenJCK] 3 steps | 180 tokens | 1.2s
[OpenJCK] View trace → http://localhost:7823/trace/a3f9c1b2