Choose a setup method
Start with one method for a call path. Combining SDK tracking with framework
OpenTelemetry on the same call can create duplicate interactions.
Recommended: Agnost AI skill
Recommended. Choose this path when you want your coding agent to inspect the
project, select a supported transport, make the smallest instrumentation change,
send a test event, and verify that it reached Agnost AI.
motia on npm) running on the iii engine.
Motia’s own traces describe step and function execution and carry no model data, so the
setup below captures the model calls your steps make.
Manual setup: Agnost AI SDK
src/lib/agnost.ts:
try block. The SDK only needs the input and the output.
Call await agnost.shutdown() once when the process exits, not inside a step.
Manual setup: OpenTelemetry
Motia’s runtime (iii-sdk) registers the global OpenTelemetry tracer provider in every step
process and sends those spans to the iii engine. The engine exports over OTLP gRPC only, and
its spans have no GenAI attributes, so Agnost AI would not ingest them. Instead, give the
Vercel AI SDK a tracer from a provider of your own that exports to Agnost AI. Model calls,
tool calls, prompts, and answers then arrive as GenAI spans.
Install
@opentelemetry/api@^1.10.0 explicitly avoids an npm peer conflict between the
current OTLP exporter and the older OpenTelemetry packages that motia depends on.
Setup
1. Addsrc/lib/agnost-otel.ts
AGNOST_ORG_ID in the environment that starts the engine (iii -c iii-config.yaml), so
the step process inherits it.
What appears in Agnost AI
- Conversations grouped by
sessionId. - User-level analytics grouped by
userId. - Events: one
motia-chatagent event pergenerateTextcall, withagent_stepandchatchildren for each model request and a tool event (heregetWeather) for each tool call, with its arguments and result.
Verify
Call the endpoint once, for examplecurl -X POST localhost:3111/chat -H 'content-type: application/json' -d '{"message":"What is the weather in Paris?","userId":"u-42","sessionId":"conv-abc123"}',
then open Events in Agnost AI. Confirm a motia-chat event with the message as input and
the reply as output, a getWeather tool event, and the session and user on the conversation.
Troubleshooting
- No events: confirm the step imports
./lib/agnost-oteland thatAGNOST_ORG_IDis set in the engine’s environment. Spans are batched and sent within about five seconds. - A process has one global tracer provider, and Motia’s runtime registers it. Calling
NodeSDK.start()orprovider.register()in a step either fails or takes over Motia’s tracing, depending on load order. Pass the tracer tonew OpenTelemetry({ tracer })as shown instead. - The iii engine’s own OTLP exporter (
OtelModuleiniii-config.yaml) uses gRPC and sends function spans without model data. Do not point it at Agnost AI. - Python steps: wrap the model call with the Python SDK the same way as the TypeScript SDK example above.
References
Next steps
- Conversations: review the complete Motia interaction.
- Events: inspect model and tool calls made by your steps.
- Patterns: organize production conversations by what users wanted.