---
title: "Building Sentry's Laravel AI Integration"
description: "Sentry's Laravel AI integration, shipped in sentry-laravel 4.27, adds Agent Tracing to Laravel AI agents with no code changes."
url: "https://swe.quest/articles/building-sentry-s-laravel-ai-integration-db97aa7ed43fc2ee"
canonical: "https://blog.sentry.io/sentry-laravel-ai-integration/"
source: "Sentry"
published: "2026-09-21"
difficulty: "medium"
kind: "Case study"
reading_minutes: 4
tags: ["php","observability","ai-agents","ai-coding"]
---

# Building Sentry's Laravel AI Integration

A post on [Sentry](https://swe.quest/sources/sentry.md), published 2026-09-21, 4 min read, Case study. Original: [https://blog.sentry.io/sentry-laravel-ai-integration/](https://blog.sentry.io/sentry-laravel-ai-integration/)

## Summary

Sentry's Laravel AI integration, shipped in sentry-laravel 4.27, adds Agent Tracing to Laravel AI agents with no code changes. Because PHP can't easily wrap or patch functions, it hooks Laravel AI's agent and tool lifecycle events, then derives per-LLM Chat spans from Laravel's HTTP client events. Outgoing request URLs are matched against each active invocation's provider URL prefix, and the most recently started invocation wins when several match. Built during a hackweek with Claude, the work also surfaced AI-generated overly defensive PHP that ignored Laravel's typed event shapes.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PHP](https://swe.quest/tags/php.md) (Languages)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)

## Prerequisites

- Laravel events
- distributed tracing spans ([easy posts on Observability](https://swe.quest/tags/observability.md?difficulty=easy))

## Keywords

Laravel AI, Sentry, sentry-laravel, Agent Tracing, Claude

## Related posts

- [Keeping it Bref: Sentry now supports PHP on AWS Lambda](https://swe.quest/articles/keeping-it-bref-sentry-now-supports-php-on-aws-lambda-57aed80b39dce9ab.md): Sentry · 2026-11-18 · Medium · 4 min read · PHP, Serverless, Observability, Cloud platforms
  The new sentry/sentry-bref integration reports PHP errors on AWS Lambda that the Sentry SDK cannot see from inside PHP-FPM, such as timeouts (Bref kills PHP-FPM 1 second before the Lambda deadline) and responses over the 6 MB limit.
- [Five things you can do with Sentry’s Agent Tracing](https://swe.quest/articles/five-things-you-can-do-with-sentry-s-agent-tracing-5ac2ff6886459921.md): Sentry · 2026-10-28 · Medium · 19 min read · AI agents, Observability, Evaluation, LLMs
  Sentry's Agent Tracing captures model calls, tool executions and multi-agent handoffs in a single trace, and Sentry Cookbook recipes build workflows on top of that data.
- [Building AI-Powered Observability with Heroku Managed Inference and Agents](https://swe.quest/articles/building-ai-powered-observability-with-heroku-managed-inference-and-agents-c65a18c2ea58a958.md): Heroku Engineering · 2026-02-13 · Medium · 5 min read · AI agents, Observability, Go, Debugging
  Observability platforms like Splunk, Honeycomb and Sentry can be exposed to AI coding assistants as MCP tools, so engineers query production telemetry in natural language from Cursor or Claude instead of switching to dashboards and writing SPL.
- [Debugging our AI search assistant with agent tracing](https://swe.quest/articles/debugging-our-ai-search-assistant-with-agent-tracing-56459c7d4f094d19.md): Sentry · 2026-09-11 · Medium · 4 min read · AI agents, Observability, Debugging, Evaluation, LLMs
  Sentry's Search Query Assistant converts natural-language prompts into Sentry Search Syntax, and its team relies on evals plus agent tracing to debug wrong outputs.
- [Trace and evaluate Cursor agents with Langfuse, powered by ClickHouse](https://swe.quest/articles/trace-and-evaluate-cursor-agents-with-langfuse-powered-by-clickhouse-b04d90713d1833e1.md): ClickHouse · 2026-10-22 · Medium · 5 min read · AI for coding, Observability, Evaluation, AI agents
  The Langfuse Observability plugin for Cursor captures each agent prompt as a \`Cursor Turn\` trace containing LLM observations, tool executions, subagents and token usage, stored in a wide ClickHouse observations table that avoids trace/observation joins for cost and latency aggregation.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
