Installation
Quick Start
Coding Agent Prompt (Cursor, Claude Code)
Coding Agent Prompt (Cursor, Claude Code)
Copy this prompt into your coding agent (tested with Cursor and Claude Code using Sonnet 4.5):
Basic Configuration
Tracing
Custom (Recommended)
Using Start/End to Instrument Existing Functions
The recommended way to add tracing to existing functions without restructuring them:
Startreturns an updatedcontext.Context(for nested span propagation) and anActiveSpandefer span.End()ensures the span is always completed and sentSetInput/SetOutput/SetErrorrecord data on the spanEndis idempotent — calling it multiple times is safe
Using client.Span (Closure Style)
Wrap inline code in a closure. Output is captured automatically from the return value. Use WithInput to record inputs:
Using GetFunction for a Static Trace Key
Bind a trace function key once, then create multiple spans without repeating it:
Automatic Nesting
Spans nest automatically when you passctx from the outer span callback:
Span Options
Parameters:traceFunctionKey(required): Groups spans under a function key in SimforgeWithName(name)(optional): Display name. Defaults to the trace function keyWithType(spanType)(optional): Span type. Defaults to"custom"WithFunctionName(name)(optional): Override the function name in span dataWithInput(args...)(optional, closure style only): Record input data. A single arg is stored directly; multiple args as a slice
Error Handling
Errors are captured in the span and returned to the caller:Flushing Traces
atexit hook. You must call FlushTraces before your program exits to ensure all pending spans are sent.