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

Prism Harness Laravel Package

particle-academy/prism-harness

A testing harness for Laravel's Prism AI package. Fake model responses, record and replay AI interactions, and assert prompts, tool calls, and outputs in your test suite without hitting real APIs or burning tokens.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enforcing per-tenant, per-workspace, or per-user AI spend caps before a provider request is made, including multi-worker deployments that need a shared host account of capped spend.
  • Roadmap decisions around enterprise tiers, prepaid credits, usage-based billing, internal chargeback, and cost-center reporting for AI features.
  • Build-vs-buy: adopt this package for capped-call lifecycle semantics—admission, reservation, refusal, settlement, and continuation coverage—while building only the host-owned persistence, reconciliation, and expiry logic around it.
  • Use cases: customer-facing AI features with budget guardrails, agent/workflow runs that mix text, structured, streaming, and approval continuations, and support/finance workflows that need refusal codes and exact charged amounts.
  • Product observability and incident response: distinguish "budget refused" from provider failure, reconcile harness charges with host ledgers, and detect worker-death reservation leaks via host-side expiry.

When to Consider This Package

  • You make capped Prism/Harness model calls and need a host-controlled observer that can refuse calls before any provider request, and settle exactly once with the harness-charged amount.
  • You run multiple workers or processes and need a shared spend account that is authoritative on the host side.
  • You need coverage across send, sendStructured, stream, and approve/deny/decide continuations on the capped path.
  • You can implement persistence for reservations and settlements, and expire stale reservations when workers die between reserving() and settled().
  • You are comfortable injecting via RunContext::root(..., observer: $observer) or configuring prism-harness.cost_observer as a container-resolved class.
  • Look elsewhere or defer if: you do not use cost caps; you need uncapped concurrent calls with an observer (uncapped runs are refused with budget_observer_uncapped); you expect the harness to meter observer behavior (the observer is trusted host code); or you need out-of-box persistence rather than host-owned ledger storage.

How to Pitch It (Stakeholders)

  • Executives: v0.15.0 adds hard, pre-flight AI spend controls shared across workers, enabling predictable unit economics, tenant-level budget enforcement, and fewer bill-shock incidents. No breaking changes.
  • Engineering: Implement CallCostObserver with reserving() and settled(); throwing from reserving() refuses the call before any provider request, and settled() provides exact charged amounts for completed, failed, and abandoned-stream calls. Inject through RunContext or config. Key caveats: capped runs only, host owns persistence and stale-reservation expiry, and the observer is trusted host code.
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.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin