Skip to content

@trace_tool

@trace_tool(name=None)
ParameterTypeDefaultDescription
namestrNoneDisplay name for the tool in the UI timeline
from openjck import trace_tool
@trace_tool
def web_search(query: str) -> str:
# tool logic here
return results
from openjck import trace_tool
@trace_tool(name="Google Search")
def web_search(query: str) -> str:
# tool logic here
return results
from openjck import trace_tool
import asyncio
@trace_tool
async def fetch_url(url: str) -> str:
# async tool logic here
return content
FieldTypeDescription
argumentsdictParameters passed to the function
return_valueanyValue returned by the function
duration_msintExecution time in milliseconds
errorstr/nullException traceback if function failed

When a decorated tool function raises an exception:

  • The exception is captured and stored in the error field
  • The original exception is re-raised so your error handling still works
  • The entire trace run is marked as “failed” in status
  • Failed steps are highlighted in red in the UI timeline

Here’s how a tool_call step appears in the trace JSON:

{
"step_id": 2,
"type": "tool_call",
"name": "web_search",
"duration_ms": 850,
"input": {
"arguments": {
"query": "capital of France"
}
},
"output": {
"return_value": "Paris is the capital and most populous city of France."
},
"error": null
}