Trace Spring AI
Agent Frameworks
Auto-instrument Spring AI with traceAI in under 3 minutes. Every LLM call, tool use, retrieval, and chain step becomes an OpenTelemetry span you can search, replay, and debug.
Recipes for Spring AI
Prerequisites
Before you start
- · A working Spring AI app — local or already in production.
- · A free Future AGI account with
FI_API_KEYandFI_SECRET_KEY. - · Python 3.9+ / Node 18+ / Java 17+ depending on which SDK you're installing.
Install
<dependency>
<groupId>ai.futureagi</groupId>
<artifactId>traceai-spring-ai</artifactId>
<version>LATEST</version>
</dependency>Trace recipe
import ai.futureagi.fi.instrumentation.TraceProvider;
import ai.futureagi.traceai.spring_ai.SpringAIInstrumentor;
TraceProvider provider = TraceProvider.builder()
.projectName("spring_ai_app")
.projectType("observe")
.build();
new SpringAIInstrumentor().instrument(provider);
// Your existing Spring AI code runs unchanged.
// Every call is now an OpenTelemetry span in Future AGI.What Future AGI captures
Trace fields you'll see in the dashboard
-
Spans for every Spring AI call: input, output, latency, tokens, cost, model name, errors
-
Trace tree across LLM, tool, retrieval, embedding, and chain spans
-
Custom attributes via `using_attributes` (session_id, user_id, prompt_template, tags, custom dicts)
-
Streaming-safe — partial chunks aggregated into a single span
Common gotchas
Read these before you ship
- 01
Set `FI_API_KEY` and `FI_SECRET_KEY` in env before calling `register()` — silent fallback otherwise.
- 02
Async frameworks: instantiate the instrumentor *before* you create the client, not after.
- 03
Streaming responses are aggregated into a single span only when you use the official SDK iterator.
Next: chain it with the other recipes
Trace is the first step. Most teams add an evaluator the same week, and start optimising or simulating once they have a baseline. Each recipe takes minutes to wire up.
Adjacent integrations
More integrations like Spring AI
LangChain
Chains, agents, and LCEL pipelines with auto-traced spans for every step.
LangChain4j
Java-native chains, agents, and RAG with LangChain4j.
DSPy
Declarative LLM programs with optimisable signatures and modules.
CrewAI
Role-based multi-agent crews with task plans and tool use.