<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3" -->

---
title: Building Sentry's Laravel AI Integration | daily.dev
description: Sentry engineers describe how they built the Laravel AI integration for Agent Tracing during an internal hackweek. The team discovered Claude-generated...
canonical: https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building Sentry's Laravel AI Integration | daily.dev
og:description: Sentry engineers describe how they built the Laravel AI integration for Agent Tracing during an internal hackweek. The team discovered Claude-generated...
og:url: https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3
og:image: https://api.daily.dev/og/posts/oetM1U9W3.png
og:image:alt: Building Sentry's Laravel AI Integration
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Building Sentry's Laravel AI Integration

**[Sentry Engineering](https://daily.dev/sources/sentry)** · 5 min read · 0 upvotes · 0 comments

## Summary

Sentry engineers describe how they built the Laravel AI integration for Agent Tracing during an internal hackweek. The team discovered Claude-generated defensive PHP code that used overly generic property access instead of relying on Laravel's typed event data. Since Laravel AI doesn't emit an event for individual LLM invocations, the team matched HTTP requests to agent invocations by comparing provider URL prefixes against active invocations, associating ambiguous matches with the most recently started invocation. The integration shipped in sentry-laravel 4.27, enabling zero-config tracing: any app with Sentry tracing enabled and laravel/ai installed automatically gets Agent Tracing, with a Conversational trait adding conversation support in the Explore > Agents dashboard.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.sentry.io/sentry-laravel-ai-integration>

## Questions this post answers

### How do I enable Sentry Agent Tracing for Laravel AI agents?

Update to sentry-laravel version 4.27 or later. Laravel Agent Tracing is enabled by default whenever laravel/ai is installed and Sentry tracing is already active, with no integration to register and no Sentry-specific code required. Implementing the Conversational interface on an agent class additionally adds conversation tracking, visible in the Agents section under Explore.

_Teams instrumenting Laravel AI agents can find integration write-ups like this through daily.dev._

### Why doesn't Laravel AI expose an event for individual LLM invocations?

Laravel AI's lifecycle events (PromptingAgent, AgentPrompted, InvokingTool, ToolInvoked) cover whole agent interactions and tool calls but leave out per-call LLM invocations entirely. To fill that gap, Sentry's integration instead relies on Laravel's HTTP client events, RequestSending and ResponseReceived, matching outgoing requests to active invocations by comparing the configured provider URL prefix, since the HTTP events carry no AI invocation ID.

_Developers instrumenting PHP frameworks with partial event coverage often compare notes like this on daily.dev._

### Why did Claude generate a generic flexGet helper instead of typed property access for a Laravel PHP integration?

Claude failed to infer the correct, narrower data shape exposed by Laravel's typed Events and instead wrote a defensive helper, flexGet, that accessed fields generically from either an object or array using dynamic property syntax ($source->{$key}). This kind of overly generic fallback code is rarely necessary in PHP since the actual data shape is almost always well-defined and narrower.

_Developers reviewing AI-generated PHP code for unnecessary defensive patterns can track similar cases on daily.dev._

## Similar posts on daily.dev

- [Sentry AI Tracing with Laravel's AI SDK](https://daily.dev/posts/sentry-ai-tracing-with-laravel-s-ai-sdk-ge6abhixu) · Josh Hornby · 0 upvotes · 0 comments
- [Ship AI with Laravel: Building Your First Agent with Laravel 13's AI SDK](https://daily.dev/posts/ship-ai-with-laravel-building-your-first-agent-with-laravel-13-s-ai-sdk-h4q7lerdt) · Laravel News · 5 upvotes · 0 comments
- [You added AI to your app. Can you see what it’s doing?](https://daily.dev/posts/you-added-ai-to-your-app-can-you-see-what-it-s-doing--6egxgutjz) · Medium · 1 upvotes · 0 comments
- [Building AI Agents with Laravel: No Python Required](https://daily.dev/posts/building-ai-agents-with-laravel-no-python-required-5lpqru3o0) · Laravel · 7 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel), [#observability](https://daily.dev/tags/observability)

[View this post on daily.dev](https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building Sentry's Laravel AI Integration","url":"https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3"},"datePublished":"2026-09-21T19:12:47.491Z","dateModified":"2026-09-21T19:13:09.970Z","description":"Sentry engineers describe how they built the Laravel AI integration for Agent Tracing during an internal hackweek. The team discovered Claude-generated...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/647b91641637650604d9301e52478eaf?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/647b91641637650604d9301e52478eaf?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Sentry Engineering","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Sentry Engineering","logo":"https://media.daily.dev/image/upload/s--qqXwMThM--/f_auto/v1710505439/logos/sentry","url":"https://daily.dev/sources/sentry"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,php,laravel,observability","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Sentry Engineering","item":"https://daily.dev/sources/sentry"},{"@type":"ListItem","position":3,"name":"Building Sentry's Laravel AI Integration"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/building-sentry-s-laravel-ai-integration-oetm1u9w3#faq","mainEntity":[{"@type":"Question","name":"How do I enable Sentry Agent Tracing for Laravel AI agents?","acceptedAnswer":{"@type":"Answer","text":"Update to sentry-laravel version 4.27 or later. Laravel Agent Tracing is enabled by default whenever laravel/ai is installed and Sentry tracing is already active, with no integration to register and no Sentry-specific code required. Implementing the Conversational interface on an agent class additionally adds conversation tracking, visible in the Agents section under Explore. Teams instrumenting Laravel AI agents can find integration write-ups like this through daily.dev."}},{"@type":"Question","name":"Why doesn't Laravel AI expose an event for individual LLM invocations?","acceptedAnswer":{"@type":"Answer","text":"Laravel AI's lifecycle events (PromptingAgent, AgentPrompted, InvokingTool, ToolInvoked) cover whole agent interactions and tool calls but leave out per-call LLM invocations entirely. To fill that gap, Sentry's integration instead relies on Laravel's HTTP client events, RequestSending and ResponseReceived, matching outgoing requests to active invocations by comparing the configured provider URL prefix, since the HTTP events carry no AI invocation ID. Developers instrumenting PHP frameworks with partial event coverage often compare notes like this on daily.dev."}},{"@type":"Question","name":"Why did Claude generate a generic flexGet helper instead of typed property access for a Laravel PHP integration?","acceptedAnswer":{"@type":"Answer","text":"Claude failed to infer the correct, narrower data shape exposed by Laravel's typed Events and instead wrote a defensive helper, flexGet, that accessed fields generically from either an object or array using dynamic property syntax ($source-\u003e{$key}). This kind of overly generic fallback code is rarely necessary in PHP since the actual data shape is almost always well-defined and narrower. Developers reviewing AI-generated PHP code for unnecessary defensive patterns can track similar cases on daily.dev."}}]}
```

