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 Agent Loops Laravel Package

thomsontochi/laravel-agent-loops

thomsontochi/laravel-agent-loops is a Laravel package for building and running iterative agent loops in PHP. It helps orchestrate AI/agent workflows with repeatable steps, tool calls, and lifecycle hooks inside your Laravel app, keeping loop logic structured and testable.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package:

composer require thomsontochi/laravel-agent-loops

If you use Laravel Boost, run php artisan boost:install — v0.4.0 ships guidelines and an agent skill inside the package, so Boost picks them up automatically. For other coding agents (Claude Code, Cursor, Copilot), install the skill directly:

npx skills add thomsontochi/laravel-agent-loops

First place to look: the README section “Teach your AI coding agent to use it” and the skill’s rules. The skill teaches your coding agent how to install the package, choose a loop, compare loops on cost and quality, and write custom loops — so you can ask your AI assistant to scaffold a loop instead of hand-writing boilerplate.

First use case: a customer-support reply agent. Ask your coding agent to scaffold a simple loop using the skill, run it against one test input, and inspect the answer plus the cost. This gives you a baseline before wiring it into a real workflow.

Implementation Patterns

  • Start with a built-in loop for common tasks. The package targets support, content writing, code review, email replies, research, and similar workflows. Use the skill to pick the right loop by describing your use case in plain language.
  • Measure before you commit. Run a small evaluation set through two or three candidate loops and compare both cost and quality. The skill’s rule “Measure before you pick a loop” is the intended workflow — don’t guess based on model names or benchmark scores.
  • Keep business rules in code, not prompts. The skill’s first rule — “The AI talks. The code decides the money” — means budget caps, model selection, retry limits, and approval thresholds belong in your Laravel code/config. The AI generates language; your code enforces constraints.
  • Write rules as facts, including what is NOT offered. When defining loop instructions or tool schemas, state negative constraints explicitly (e.g., “We do not offer refunds after 30 days”). This reduces hallucinated commitments.
  • Custom loops: extend the package’s base loop class (or implement the expected interface), register it in config, and let the skill generate the skeleton. Custom loops are the extension point for domain-specific control flow.
  • Laravel integration: dispatch loop runs as queued jobs for long tasks, emit events for observability, and store loop traces (prompts, responses, tool calls, costs) for debugging. This fits naturally with Laravel’s queue and event systems.
  • Use Laravel Boost day-to-day. Once installed, the skill and guidelines load automatically, so AI-generated code follows the package’s idioms instead of hallucinating APIs. Re-run boost:install after upgrading the package to refresh the skill.

Gotchas and Tips

  • Don’t let the AI decide cost-related actions. A common pitfall is letting the model choose its own model, retry count, or tool budget. Hard-code these decisions or gate them behind code-level policy.
  • Read the answers, not just the scores. Automated quality scores can be misleading. The skill explicitly warns against optimizing for a metric without inspecting real outputs — especially for customer-facing text.
  • Vague rules cause drift. “Be helpful” is not a rule. Write concrete facts and negative constraints; the skill’s guidance is designed to keep prompts factual and bounded.
  • Debugging: log every loop iteration — prompt, response, tool calls, token usage, and cost. If a loop runs too long, check termination conditions and max-iteration config first.
  • Config quirks: Laravel Boost auto-discovery means the skill is available after boost:install, but if you upgrade the package you may need to re-run it. With npx skills add, the skill lives outside the repo — keep it updated when the package changes.
  • Extension points: custom loop classes, evaluators, and cost calculators are the intended places to adapt behavior. The skill understands these if you ask it to “write a custom loop” or “add an evaluator.”
  • Upgrade safety: v0.4.0 has no breaking changes and requires no code changes. The main addition is the agent skill and Boost support, so upgrading is low-risk.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager