Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Llm Observability Laravel Package

mubseoul/laravel-llm-observability

Laravel LLM Observability gives you visibility into every AI request your app makes: log prompts and responses, track token usage, latency, and cost, and debug failures across OpenAI, Anthropic, and other providers, all from a familiar Laravel-friendly package.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Laravel-native package (service provider, config publish, migrations, middleware, optional Filament panel) — aligns cleanly with a standard Laravel monolith or multi-tenant SaaS. It slots into the existing app kernel rather than introducing a separate runtime or sidecar.
  • Covers the three concerns most teams end up hand-rolling: per-request telemetry (tokens/cost/latency), attribution (user/team/API key), and enforcement (quotas). That overlap is the main value proposition and the main reason to consider retiring bespoke instrumentation.
  • The middleware-based quota enforcement implies LLM traffic must flow through a package-aware code path. Any direct SDK calls that bypass that path are invisible to tracking and unenforced by quotas — this is the central architectural constraint to validate.

Integration feasibility

  • Install is genuinely low-friction: composer require, publish config, php artisan migrate. No infrastructure dependencies beyond the existing database and (for async mode) a queue worker.
  • Filament dashboard is opt-in, so teams not on Filament can still adopt the core tracking/quotas and defer the UI.
  • Real effort is not installation but instrumentation: wrapping every LLM call site, deciding sync vs async recording, and defining the tenant scoping model (global/user/team/API key) up front. Budget for the wiring, not the composer line.

Technical risk

  • v1.0.0 maturity: first stable release, single-maintainer package. No track record on upgrade discipline, security response, or long-term maintenance. Treat as a dependency with vendor risk and plan for fork-readiness.
  • Data sensitivity: request logs and metadata imply prompt/response persistence or references. PII handling, redaction, encryption-at-rest, and retention policy are not described in the release notes and must be confirmed before production rollout.
  • Pricing table drift: built-in pricing for OpenAI/Anthropic/Ollama will go stale between provider price changes. Cost accuracy is only as good as the update cadence — the custom pricing provider escape hatch mitigates this but pushes maintenance onto us.
  • Write amplification: per-request rows at volume will stress the primary database. Sampling and async mode exist but shift the problem to queue throughput and eventual consistency of quota counters.
  • Quota enforcement in the hot path: middleware that blocks on DB state can fail closed during a database incident and take down all LLM features. Fail-open/fail-closed behavior must be configurable and explicitly chosen.
  • Schema ownership: package migrations add tables to our database; future package versions may evolve them. Need a migration/rollback story.

Key questions

  1. How is instrumentation performed — HTTP client wrapper, SDK decorator, or manual calls? What fraction of our call sites are covered out of the box?
  2. Are prompts/responses stored, and if so where, for how long, and with what redaction? Can we run metadata-only?
  3. How are quota counters maintained (DB row locking, cache/Redis) and what is the behavior when the store is unavailable — fail open or closed?
  4. What is the pricing table update process and expected lag after a provider price change?
  5. What is the actual test coverage and CI signal (the release notes claim a Pest suite and GitHub Actions; need coverage numbers and whether integration paths against real providers are mocked)?
  6. License terms, maintainer capacity/backing, and stated support expectations for a 1.0.0 OSS package.
  7. Multi-tenancy model: is team scoping first-class, and does it survive Laravel's tenancy patterns (single-DB scoped vs multi-DB)?
  8. Retention/archival: does anything prune the request log table, or is that ours to build?

Integration Approach

Stack fit

  • Requires PHP 8.2+ and Laravel 10/11. Strong fit for a Laravel-centric engineering org; effectively irrelevant if the LLM-calling services are not Laravel (Python/Node gateways won't be covered).
  • Filament 3.2+ dependency is optional and should stay optional — do not let a dashboard requirement gate the core rollout, and confirm it doesn't force a Filament upgrade on teams that already run an older version.
  • Coexists naturally with an external observability tool (Helicone, Langfuse, Datadog LLM Observability). Reasonable posture: use this package for in-app cost attribution and quota enforcement, keep external tooling for deep tracing/eval — avoid duplicating cost calculation in two places.

Migration path

  • Greenfield addition — no data migration required, just new tables. Lowest-risk possible adoption shape.
  • If we have existing bespoke token/cost logging, plan a parallel-run period: dual-write, reconcile cost numbers against the package's pricing tables, then cut over. Do not delete the old path until reconciliation shows parity.
  • If quotas are currently enforced in application code, migrate enforcement scope-by-scope (start with the loosest scope, e.g. global cost cap) rather than flipping all scopes at once.

Compatibility

  • Verify supported database engines and versions against our fleet, queue driver support (Redis/SQS/database), and cache store for counter accuracy.
  • Confirm the package's Laravel 10→11 (and future 12) upgrade posture before we commit — a package pinned to 11.x becomes an upgrade blocker at the next framework bump.
  • Check PHP 8.2 floor against our oldest deployed service; also check for conflicts with existing packages over Filament/Livewire versions.

Sequencing

  1. Spike in a non-production environment: install, migrate, instrument a single LLM call path, verify recorded tokens/cost match provider invoices within tolerance.
  2. Instrument all call sites behind a thin internal wrapper so we can swap or remove the package without touching product code.
  3. Enable sync recording in staging, measure write volume and latency overhead; switch to async/sampling only if measurements justify it.
  4. Pilot quota enforcement on one low-blast-radius scope (e.g. internal tooling or a single free-tier API key) with fail-open configured.
  5. Roll out the Filament dashboard to internal stakeholders once data quality is trusted.
  6. Add alerts/webhooks last — they are additive and depend on trustworthy metrics.
  7. Reconcile costs against provider billing for one full cycle before treating numbers as authoritative for chargeback.

Operational Impact

Maintenance

  • Ongoing work: pricing table currency (either track upstream releases or maintain a custom pricing provider), package version upgrades alongside Laravel/Filament upgrades, and ownership of the request-log table's growth and retention.
  • New dependency surface in the request path means package regressions become production incidents — assign an explicit owner rather than adopting it as a side project.

Support

  • Single-maintainer OSS at 1.0.0: assume best-effort community support, no SLA. Mitigations: vendor the source, keep our wrapper abstraction thin, and be prepared to fork. Budget for a periodic security/dependency review (composer audit, advisory monitoring).
  • Internal support burden: someone must become the go-to for cost discrepancies and quota edge cases; that is a real on-call-adjacent role, not a one-time setup.

Scaling

  • Primary scaling risk is database write volume proportional to LLM request rate. Mitigations: async recording, sampling, and partitioning/pruning on the request log table.
  • Quota counters add read/write pressure per request; confirm whether they use cache-backed counters or per-request DB transactions with locking. Under load, contended counter rows can serialize traffic.
  • Cost aggregation queries (by user/team/period) will need appropriate indexes; plan to run rollups rather than scanning raw logs for dashboards.
  • Queue depth becomes the new failure surface in async mode — quota enforcement accuracy lags reality, so hard spend caps should not rely solely on async counters.

Failure modes

  • Database outage → tracking writes fail and quota middleware may fail closed, blocking all LLM features. Must be explicitly configured to fail open for tracking and to have a defined posture for enforcement.
  • Stale pricing → under- or over-stated cost, incorrect quota exhaustion, and bad chargeback data. Detect via reconciliation against provider invoices.
  • Queue backlog in async mode → dashboards and quota state go stale; alerts fire late.
  • Webhook retry storms during an incident can amplify load on the receiving side; cap concurrency and alert on delivery backlog.
  • Uninstrumented call sites silently bypass both tracking and quotas — the most likely and most damaging operational gap; enforce via code review/lint rule that all LLM clients go through the wrapper.
  • Data sensitivity incident if prompt content is stored more broadly than expected — resolve before production.

Ramp-up

  • Low technical ramp-up for a Laravel team: config file plus a middleware plus a wrapper. Expect roughly a sprint for a small team to instrument a pilot service and validate cost accuracy, then incremental work per additional service.
  • Conceptual ramp-up is higher: the team must agree on tenant scoping (user vs team vs API key), quota policy (which scope, which window, fail-open or closed), and cost attribution semantics before the data is meaningful. These are product/policy decisions, not engineering ones, and should be settled in the spike, not after rollout.
  • Dashboard consumers (finance, engineering leads, support) need a short enablement pass on reading cost breakdowns and interpreting alert thresholds, or the dashboard becomes a screenshot generator.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle