catidegla/laravel-agent-kit
A Laravel toolkit for building AI agents and adding agentic workflows to your app. It offers a structured way to define agents, manage prompts and tools, and connect them with Laravel services, making AI-powered features easier to organize, test, and ship.
This release is about hardening an existing surface rather than adding new API, so the fastest path is still: composer require the package, publish its config, and point it at one model you already understand.
Ticket or Article. The generated class is real code that serialises through laravel/mcp, so it is a working starting point, not a stub you have to wire up.First real use case: a read-only "look up my ticket by ID" tool. It exercises the whole chain — policy get, payload shaping, the denied-vs-missing rule — in about twenty lines, and every later tool is a variation on it.
Version floor: Laravel 13 requires PHP 8.3. If your app is on 8.2 you stay on Laravel 12 and this release changes nothing for you; the constraint widened rather than moved.
Policy-per-model, explicitly. Treat the policy as the only authorisation boundary. Don't also filter in the tool body — two places to check means one gets out of sync. Define the abilities the package asks for and let denials propagate.
Shape payloads with an allowlist, never toArray(). The release notes assert internal_notes is absent from the payload and that no field value reaches the audit record. That only stays true if every tool returns an explicit array of named fields. Make "never return a model or a ->toArray()" a review rule.
Expose relations deliberately. A relation cannot reach a model nobody exposed, which means nested data is opt-in twice: once for the parent, once for the child. Model this as an explicit graph in config or policy rather than relying on $with, and you get predictable payloads for free.
Audit as identifiers, not values. Log tool name, actor, model class, record ID, and outcome. The moment you log the request payload you have recreated the leak the package is built to prevent.
Test the properties, not the prose. The 58-test suite asserts absences — that Bob's ticket is not in Alice's list, that a denied get is indistinguishable from a missing one. Copy that style: assert assertJsonMissingPath('internal_notes'), assert a 404-equivalent for the denied case, assert the audit table has no field values. Property-style assertions survive refactors; assertSee('Alice') does not.
Keep generated tools in version control and edit them in place. Regeneration is for new tools, not for refreshing existing ones — you will lose your allowlist.
get returning a distinct 403 tells an attacker the record exists. The indistinguishable response is the feature; resist the pull request that adds a friendlier error.$hidden and $visible are not the exposure mechanism. They govern Eloquent serialisation, not what this package will emit. Two systems with similar names and different jobs — keep the allowlist authoritative and consider not returning models at all.->with('customer.contracts') may pull in a model you never exposed. If a payload grows unexpectedly, check with() before you check the policy.Assessment: v0.5.0 is a compatibility and confidence release, not a breaking one. Laravel 12 support is unchanged and the constraint widened rather than moved, so upgrading is low-risk on any PHP 8.2+ app. The substantive signal is the test suite: a package whose tests assert that data is absent is telling you where its design attention went, and the day-to-day leverage follows from leaning on that — explicit policies, explicit field allowlists, identifiers-only audit trails — rather than fighting it.
How can I help you explore Laravel packages today?