Download the PHP package ronu/laravel-agent-protocol without Composer
On this page you can find all versions of the php package ronu/laravel-agent-protocol. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ronu/laravel-agent-protocol
More information about ronu/laravel-agent-protocol
Files in ronu/laravel-agent-protocol
Package laravel-agent-protocol
Short Description Agent Discovery Protocol implementation for Laravel APIs built on top of rest-generic-class metadata.
License MIT
Homepage https://github.com/charlietyn/laravel-agent-protocol
Informations about the package laravel-agent-protocol
Ronu Laravel Agent Protocol
Agent Discovery Protocol metadata, safety contracts and AI-ready API discovery for Laravel.
What is this package?
ronu/laravel-agent-protocol publishes a Laravel API as a structured Agent Discovery Protocol (ADP) metadata graph for LLM agents, MCP adapters, n8n workflows, SDK generators and documentation tooling.
The package is intentionally metadata-only:
- it does not execute business operations;
- it does not replace Laravel middleware, policies, FormRequests or services;
- it does not expose the database directly;
- it does not implement an LLM agent;
- it does not become an MCP server by itself;
- it describes what the backend already knows how to do.
The backend remains the source of truth. ADP makes that backend discoverable, explainable and safer for AI-driven automation.
The problem
Modern AI agents can understand natural language, but most business APIs are not ready for agents.
Without ADP, teams usually end up with one of these fragile patterns:
| Pattern | Problem |
|---|---|
| Huge system prompts | Expensive, hard to maintain, easy to drift from the real backend. |
| OpenAPI-only discovery | Good for endpoint shape, weak for scenarios, business semantics, permissions and agent safety. |
| Direct database access | Dangerous, bypasses API rules, policies, validation and domain logic. |
| Manual tool definitions | Duplicates backend knowledge and becomes stale quickly. |
| n8n workflows with hardcoded endpoints | Hard to scale across modules, tenants, locales and API versions. |
ADP solves this by publishing a closed, structured contract that agents can inspect before making decisions.
The core idea
The LLM interprets. ADP describes. Agent Guard validates. Laravel authorizes. rest-generic-class executes.
Where this fits
Responsibilities
| Layer | Responsibility |
|---|---|
| Laravel application | Owns business rules, policies, auth, validation, services and data. |
ronu/rest-generic-class |
Executes reusable CRUD, filtering, relations, hierarchy, exports and mutations. |
ronu/laravel-agent-protocol |
Publishes API capabilities as ADP metadata. |
| ADP Agent Guard | Validates LLM/n8n/MCP tool plans before execution. |
| n8n | Orchestrates workflows, credentials, approvals and HTTP calls. |
| MCP adapter | Exposes ADP resources and operations as MCP resources/tools. |
| LLM | Resolves natural language into a structured intent plan. |
Key features
Metadata discovery
- Modules
- Resources
- Fields
- Relations
- Operations
- Scenarios
- Validations
- Filters
- Capabilities
- Permissions
- Risk levels
- Documentation
- Dictionaries
- Reference tables
- Readiness scores
Laravel-native integration
- Laravel 11 / 12
- PHP
^8.3 - Eloquent models
- FormRequests
- Routes
- Middleware
- Policies
- Enums and casts
- Config publishing
- Artisan commands
- Cache drivers
- Service container bindings
rest-generic-class alignment
Designed to complement ronu/rest-generic-class, not replace it.
rest-generic-class executes:
- CRUD
- dynamic filters
- relation loading
- hierarchy listing
- bulk update
- soft delete / restore / force delete
- exports
- permission utilities
laravel-agent-protocol describes those capabilities for agents.
ADP Agent Guard
ADP Agent Guard is the safety layer added for agentic execution.
It validates a model-generated IntentPlan against the compiled ADP graph before an adapter calls the real API.
It is deterministic PHP logic. It does not call an LLM and does not consume tokens.
It blocks
- prompt hijacking signals;
- out-of-domain prompts;
- invented resources;
- invented operations;
- hidden or sensitive fields;
- relations not published by ADP;
- operators not allowed by the filter contract;
- high-risk operations without confirmation;
- critical operations when policy says they are blocked;
- API response data being treated as agent instructions.
Guard flow
When the integration wants a human-friendly reply, the LLM can transform the validated API result or the safe rejection into natural language for the user. This is an optional presentation step; it does not replace Agent Guard validation, Laravel authorization or backend execution.
Example: valid query
Example: blocked sensitive field
Result:
Example: blocked out-of-domain request
Result:
Example: high-risk operation requires confirmation
Result:
Installation
Requirements
- PHP
^8.3 - Laravel
^11.0or^12.0 - Recommended:
ronu/rest-generic-class
Quick configuration
Route discovery can also detect controllers extending:
Configure Agent Guard
Environment option:
Use Agent Guard
Endpoints
Bundle modes
| Mode | Use case |
|---|---|
full |
First discovery, local development, MCP server startup, n8n first load. |
slim |
Repeated executions, token-sensitive prompts, cached references. |
Metadata model
Integration with n8n
Recommended workflow:
Recommended custom n8n nodes:
| Node | Responsibility |
|---|---|
| ADP Discover | Load /agent/bundle. |
| ADP Load Resource | Load one resource descriptor. |
| ADP Load Operation | Load one operation descriptor. |
| ADP Resolve Intent | Ask LLM to produce IntentPlan JSON. |
| ADP Validate Intent | Apply Agent Guard semantics. |
| ADP Risk Gate | Require confirmation for high/critical operations. |
| ADP Execute Query | Execute safe read operations. |
| ADP Execute Operation | Execute approved mutations. |
| ADP Format Response | Format API JSON for the user. |
| ADP Audit Log | Store prompt, plan, decision and execution metadata. |
n8n should not contain business logic. It should orchestrate ADP metadata, credentials, approvals and HTTP calls.
Integration with MCP
This package is MCP-ready, but it is not itself an MCP server.
The MCP adapter should map:
| ADP | MCP |
|---|---|
ResourceDescriptor |
MCP resource, for example adp://resources/security.user. |
OperationDescriptor query |
Read-only MCP tool. |
OperationDescriptor create/update/delete |
MCP tool with risk and confirmation metadata. |
| Dictionary | Resource or prompt context. |
| Examples | Prompt templates or tool examples. |
MCP annotations are exported with ADP metadata:
The adapter should still validate every selected tool call through Agent Guard before executing HTTP requests.
Security model
ADP is a contract, not a permission bypass.
The execution chain must remain:
Default protections
- Sensitive fields are redacted by default.
- High and critical operations require confirmation metadata.
- Critical operations can be blocked by policy.
- Closed-world mode rejects unknown capabilities.
- Filter depth and condition limits are published and enforced.
- Relation allowlists prevent uncontrolled overfetching.
- API data can be wrapped as untrusted content before being sent back to an LLM.
Untrusted API data
Output:
Token-cost strategy
Agent Guard itself does not consume tokens. It runs in PHP over the compiled metadata graph.
Tokens are consumed only when an adapter sends metadata to an LLM or asks an LLM to produce or format an answer.
Recommended strategy:
| Technique | Benefit |
|---|---|
Cache /agent/bundle with ETag |
Avoid repeated metadata transfer. |
Use mode=slim after first load |
Reduce context size. |
| Send only relevant resources | Lower prompt cost. |
Use compact IntentPlan JSON |
Lower completion cost. |
| Validate in PHP | No second LLM security pass required. |
| Keep reference tables small | Avoid token-heavy catalogs. |
Cache
ADP metadata is compiled into an AgentMetadataGraph and cached.
Use compiled-file cache for production-style metadata artifacts:
Recommended deploy flow:
Artisan commands
Exporters
| Format | Purpose |
|---|---|
json |
Native ADP graph. |
json-schema |
Operation input schemas derived from validation rules. |
markdown |
Human-readable documentation from metadata. |
mcp |
MCP-style resources/tools manifest derived from ADP. |
Testing and quality
The suite covers:
- DTO serialization;
- compiler behavior;
- endpoint responses;
- metadata validation;
- security redaction;
- risk metadata;
- filter limits;
- Agent Guard decisions;
- out-of-domain blocking;
- prompt hijacking signals;
- high-risk confirmation gates;
- untrusted content wrapping.
Example scenarios
Query users by status
Query with relation
Bulk update requires risk handling
Expected result:
Documentation
- Install
- Quickstart
- Junior Guide
- Advanced Usage Guide
- Protocol
- Endpoints
- Cache
- Security
- ADP Agent Guard
- Readiness
- CLI
- Exporters
- Generated Docs
- MCP and n8n
- Schema Discovery
- ADP Spec
- End-To-End Example
- Migration
- Success Metrics
- Release and Publishing
Roadmap
Phase 1 — ADP metadata foundation
- Resource discovery
- Operation discovery
- Field metadata
- Relation metadata
- Validation descriptors
- Exporters
Phase 2 — Agent Guard
- Intent plan validation
- Domain guard
- Risk guard
- Safe rejection
- Prompt hijacking signal detection
- Untrusted data wrapper
Phase 3 — Adapter ecosystem
- n8n custom nodes
- MCP execution adapter
- SDK helpers
- Audit log integration
Phase 4 — Enterprise governance
- Tenant-aware metadata policies
- Role-aware metadata scopes
- Signed manifests
- Graph diffing
- Readiness dashboards
Design principles
- The backend owns business knowledge.
- The agent never owns authorization.
- Unknown capabilities are rejected.
- Metadata must be cacheable and versionable.
- Prompts should be small because metadata is structured.
- Safety must be deterministic whenever possible.
- MCP and n8n are adapters, not business-rule containers.
rest-generic-classexecutes; ADP describes; Agent Guard validates.
License
MIT.
All versions of laravel-agent-protocol with dependencies
illuminate/cache Version ^11.0|^12.0
illuminate/config Version ^11.0|^12.0
illuminate/container Version ^11.0|^12.0
illuminate/contracts Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/routing Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/validation Version ^11.0|^12.0