Auto-instrumentation means you add one line to your agent's code and Kynver automatically records every LLM call your agent makes — no manual tracking, no wrapping functions, no changes to your existing logic.
JavaScript / TypeScript Setup
Add this as the very first import in your agent's entry file — before any other imports:
import '@kynver-app/sdk/auto';That is the complete setup. The SDK reads KYNVER_AGENT_DID, KYNVER_API_KEY, and (optionally) KYNVER_SIGNING_KEY from your environment variables and starts tracking.
Importing this module more than once (from multiple files in the same process) is also safe — the SDK only initializes once.
What Gets Tracked Automatically
The SDK intercepts calls to these libraries if they are present in your project: - LangChain: Runnable.invoke() (chains and tools) and CompiledStateGraph.invoke() (LangGraph graphs) - OpenAI: client.chat.completions.create() - Anthropic: client.messages.create()
Each intercepted call produces a receipt automatically. The instruction is derived from the input, the output from the response, and action types from any tool calls detected.
Reporting Manually for Custom Cases
If your agent does something the auto-instrumentation does not intercept, you can report it manually using the same singleton the auto module creates:
import { reportExecutionFromAuto } from '@kynver-app/sdk/auto';
await reportExecutionFromAuto({
instruction: userInput,
output: modelOutput,
taskCategory: 'chat',
status: 'success',
});This is a no-op if the tracker is not configured (i.e. KYNVER_AGENT_DID is not set).
Python Auto-Instrumentation (Coming Soon)
Python auto-instrumentation will use LangChain's callback system. Once released, a single import will register a KynverCallbackHandler globally that hooks into on_chain_end, on_tool_end, and on_llm_end to call report_execution() automatically.
Until this ships, use the manual KynverTracker approach described in Add Execution Tracking to Your Agent (Python SDK) sdk python.
Required Environment Variables
- KYNVER_AGENT_DID — required. Auto-instrumentation is a complete no-op without this.
- KYNVER_API_KEY — recommended. Receipts are submitted to Kynver on your behalf.
- KYNVER_SIGNING_KEY — optional. For Tier 2 self-sovereign signing after passing the ownership challenge.