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 getFunction() to Link Spans
Declare the trace function key once and wrap multiple functions:
Using withSpan() Directly
For a single span without linking to a function group:
Automatic Nesting
Spans nest automatically based on call stack:Span Options
Parameters:traceFunctionKey(required): String identifier for grouping spansname(optional): Display name. Defaults to function name, then trace function keytype(optional): Span type. Defaults to"custom"metadata(optional): Key-value object (Record<string, unknown>) attached to the span for custom context (e.g. user ID, region, request ID)
Runtime Metadata
UsegetCurrentSpan() to get a handle to the active span, then call .setMetadata() to attach metadata from inside a traced function — useful when metadata depends on runtime values like request IDs, computed scores, or dynamic context:
Error Handling
Errors are captured in the span and re-raised:OpenAI Agents SDK
Attach a trace processor to capture agent runs:Native Functions
Simforge’s native functions improve prompt tuning efficacy. The auto-tuning engine has full access to prompts—unlike other Agent SDKs that nest user instructions inside system prompts, making prompts inaccessible to tracing.Advanced Configuration
envVars: Pass LLM provider API keys for local executionexecuteLocally: Whentrue(default), fetches prompts from Simforge and executes locally. Whenfalse, executes on Simforge servers.enabled: Whenfalse, all tracing is disabled. Wrapped functions still execute normally but no spans are sent.