SentryMartin LinzmayerAnnouncement
Building Sentry's Laravel AI Integration
Summary
Sentry’s Laravel AI integration, built during an internal Agent Hackweek, provides Agent Tracing for Laravel AI agents. The author used Claude for coding, which initially produced poor generic helper code. Laravel AI emits lifecycle events for agents and tool calls, but not for individual LLM invocations. To capture these, the integration matches outgoing HTTP requests to active invocations using provider URL prefixes, associating with the most recently started invocation if multiple match. Enabling the integration requires only updating to sentry-laravel 4.27, with no Sentry-specific code. Traces appear in Sentry’s Explore > Agents section, showing conversations, tool calls, and their inputs and outputs.
Context
Sentry’s Laravel AI integration was built during an internal Agent Hackweek to give Laravel AI agents the same Agent Tracing support as other frameworks. The author used Claude for coding, which initially produced poor generic helper code. Laravel AI emits lifecycle events for agents and tool calls but not individual LLM invocations, so the integration matches HTTP requests to active invocations using provider URL prefixes.
Takeaways
Laravel AI emits lifecycle events for agent interactions and tool calls, but not for individual LLM invocations, requiring a workaround.
The integration matches outgoing HTTP requests to active invocations by comparing provider URL prefixes, filtering out unrelated traffic.
Enabling Laravel Agent Tracing requires only updating to sentry-laravel 4.27; no Sentry-specific code is needed if tracing is already active.
FAQ
How does the integration trace individual LLM calls?
Laravel AI emits events for agent interactions and tool calls, but not for individual LLM invocations. To capture these, the integration matches outgoing HTTP requests to active invocations by comparing the provider URL prefix, associating with the most recently started invocation if multiple match.
Does the integration require code changes?
No, the integration requires no Sentry-specific code. If you have Sentry tracing enabled in your Laravel app, updating to sentry-laravel 4.27 enables Laravel Agent Tracing automatically when laravel/ai is installed and tracing is active.
Source and freshness
- Source
- blog.sentry.io
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.