Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Sentry 4 min read Case study mediumAdept

Building Sentry's Laravel AI Integration

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.

Assumes: Laravel eventsdistributed tracing spans

Related posts

  • Keeping it Bref: Sentry now supports PHP on AWS Lambda

    Sentry mediumAdept

    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. It hooks into the long-lived Bref runtime around each invocation, boots the Laravel or Symfony app there to reuse its Sentry client, and handles non-HTTP events. For SQS, EventBridge and S3 events it creates one transaction per invocation with an isolated scope per invocation, records cold-start spans (measured in the runtime and passed via /tmp), traces opted-in AWS SDK clients, and links each event to its CloudWatch logs. Timeout reporting only works with Laravel and Symfony, and the cold-start span excludes the time Lambda spends creating the instance before PHP starts.

  • Five things you can do with Sentry’s Agent Tracing

    Sentry mediumAdept

    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. One recipe exports production conversations with `sentry agent-conversation list` (CLI 0.44+), maps them to eval records, upserts them into Braintrust, Langfuse, promptfoo or Arize Phoenix, and scores them with deterministic checks plus an LLM judge reserved for subjective quality. Practical traps it calls out: summing tokens from raw `gen_ai.invoke_agent` spans double-counts, the CLI defaults to only 25 conversations over 7 days, and recorded prompts may contain PII. A second recipe runs a daily Claude scheduled task that uses the Sentry MCP server to triage agent failures and file Linear tickets.

  • Building AI-Powered Observability with Heroku Managed Inference and Agents

    Heroku Engineering mediumAdept

    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. The Go servers define typed MCP tools and handlers that translate tool calls into platform API calls. They are deployed as STDIO processes behind Heroku Managed Inference and Agents, whose MCP gateway handles SSE transport and auth, and clients connect via mcp-remote with an inference token. Claimed benefits include faster incident triage, security pattern spotting such as auth-failure spikes, and quicker onboarding, though the evidence is anecdotal and promotional.

  • Debugging our AI search assistant with agent tracing

    Sentry mediumAdept

    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. One bug made queries on custom numeric attributes return nothing. Tracing the conversation's system prompt, LLM generations and tool calls through to the backend API trace showed the prompt listed fields by bare name (e.g. bug__predictions_count) instead of the required tags[name, number] form. The team turned that finding into a new eval, fixed the bug, confirmed the fix in production traces, and now sends local eval runs to Sentry too.

  • Trace and evaluate Cursor agents with Langfuse, powered by ClickHouse

    ClickHouse mediumAdept

    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. Setup is a Marketplace install plus a `~/.cursor/langfuse.json` key file. File-content capture is off by default, and because Cursor reports tokens once per turn, cost should be read from the trace total. A worked loop shows finding expensive turns caused by repeated file reads and retried shell commands, fixing them with a project rule, and validating the fix with dataset-based evaluations, which can also gate CI via a GitHub Action.

The quest for software engineering knowledge.

Look:
Layout: