Download the PHP package packstub/agents without Composer

On this page you can find all versions of the php package packstub/agents. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package agents

Agents for Laravel

[![Latest Version on Packagist](https://img.shields.io/packagist/v/packstub/agents.svg?style=flat-square)](https://packagist.org/packages/packstub/agents) [![Tests](https://img.shields.io/github/actions/workflow/status/packstub/agents/tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/packstub/agents/actions/workflows/tests.yml) [![Total Downloads](https://img.shields.io/packagist/dt/packstub/agents.svg?style=flat-square)](https://packagist.org/packages/packstub/agents) [![License](https://img.shields.io/packagist/l/packstub/agents.svg?style=flat-square)](https://github.com/packstub/agents/blob/main/LICENSE.md) [![Sponsor](https://img.shields.io/badge/sponsor-%E2%9D%A4-ea4aaa?style=flat-square&logo=githubsponsors&logoColor=white)](https://github.com/sponsors/icaliman)

An AI agent and an MCP server for your Laravel app, built on laravel/ai and laravel/mcp. Write a tool once and it serves both your own assistant and Claude Code, Claude Desktop, Cursor or any other MCP client, with your app's own authorization deciding who may run it. Filament Agents puts a chat and the operator pages on top of it inside a Filament panel.

A question about pending orders: the search-orders and show-table calls folded above the answer, a proposal to confirm order RO-00016 with Approve and Reject buttons, and the live Orders table filtered to the three pending rows

The engine's tools, turns and approvals, as Filament Agents shows them in a panel. Without Filament, your own chat surface drives the same calls through AgentChat.

Features

Compatibility

Package Laravel PHP laravel/ai laravel/mcp
1.x 13.x 8.4+ ^0.11 ^0.9

Installation

The install command publishes the config, offers to run the migrations and scaffolds app/Ai/Agents/Assistant.php. Register the agent and the tools in a service provider and put a provider key in .env (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY or XAI_API_KEY, with AGENT_PROVIDER=anthropic|openai|gemini|xai):

The MCP endpoint answers without a key, since it does not need a model. Read more: Installation.

In a Filament panel

packstub/filament-agents requires this package and adds what a panel shows: the chat pages with an "Ask …" button, approve-in-chat writes, show-table rendering a resource's own table under an answer, the Agent access page that mints tokens, and the operator's AI limits and AI turns pages. Install it instead of this package in a panel app; everything on this page applies unchanged, registered through AgentsPlugin instead of the facade. Read more: Filament Agents.

Writing tools

A tool extends Packstub\Agents\Mcp\AgentTool, declares its $ability, and implements run(Request): array and schema(JsonSchema): array. Mark reads with #[IsReadOnly]; anything else is approval-gated for the agent and needs a write token over MCP. Domain exceptions come back to the model as tool errors, never to the person as a crash.

List the tools on the server class, reads first. The agent reads the same list:

Agents::useTools([...]) works instead of a server class. A write tool may add describe(array $arguments): ?string to phrase its own proposals ("Confirm order RO-00016 for Acme?"); without one the question is the tool's title and its first argument. Read more: Tools.

A request to confirm an order paused as the question

The agent

packstub-agents:agent scaffolds App\Ai\Agents\Assistant, a subclass of Packstub\Agents\Ai\Agent with two slots to fill: persona() (who it is) and domain() (what the workspace is). The base class supplies the generic working and answering rules, the dynamic context (date, workspace, person, role, language — sent with the question, so the system prompt and the history stay cacheable) and the provider options (Anthropic cache breakpoints on the instructions and the settled history, reasoning effort or thinking level per model). Append to any of them by overriding workRules(), answerRules() or context() and merging the parent's list; suggestions() gives an empty chat its starter questions.

It runs on Anthropic, OpenAI, Gemini or xAI with a model catalog (Claude Opus 5, Claude Haiku 4.5, Claude Opus 5 · Deep); any other laravel/ai provider, Ollama included, runs on its smartest and cheapest models. A failover list (AGENT_FAILOVER=gemini,openai) keeps answering when a provider is overloaded.

Read more: The agent.

Running a turn

Start a conversation, queue a turn, poll it. The RunAgentTurn job restores who asked and where (the person, the guard, the workspace, the locale), runs the middleware pipeline with the budget check, streams the answer from the provider and records what it cost:

AgentChat::for($user) wraps this for a chat surface of your own (send, decide, retry, stop, the transcript with its proposals, the context meter). GET agents/chat/{conversation}/turn returns the answer so far and a status line; run php artisan queue:work, or set AGENT_TURN_DRIVER=sync to run the job inside the request — a turn no worker takes within AGENT_WORKER_WAIT seconds says so on that status line. Long chats replay a token-budgeted window with a rolling summary. Read more: The agent.

Filters and charts

A class implementing AgentResource gives the model a filter vocabulary and a record summary, shared by every search tool that names the same key:

Register it with Agents::useResources([Orders::class]). draw-chart renders bar, line, pie and doughnut charts from numbers the model already retrieved, and any tool can return a chart key of its own. Read more: Tables and charts.

A question about order value over four weeks answered with a sentence and a bar chart, Order value by week

MCP clients

Mint a Sanctum token with the abilities the client should have — read, write, tool:{name} to scope it, tenant:{slug} to bind it to a workspace — and connect any MCP client to POST /mcp:

The endpoint sits behind throttle, auth:sanctum and the package's own middleware, so external agents get exactly the tools the person's role and their token allow. Read more: MCP clients.

The Create token modal from Filament Agents: read and write abilities, an expiry, and the tools table with a Read or Write badge per tool; the ticked tools become tool:{name} abilities on the token

Budgets and limits

config/packstub-agents.php holds the platform ceiling (AGENT_TURNS_PER_MINUTE, AGENT_TURNS_PER_DAY, AGENT_TOKENS_PER_DAY, AGENT_TOKENS_PER_MONTH, AGENT_USER_TOKENS_PER_DAY, AGENT_USER_TOKENS_PER_MONTH, AGENT_PROMPT_MAX_CHARS). Rows in agent_limits override it: one global row, optional rows per workspace and per user, empty fields inherit. AgentBudget::summary() gives the numbers for a settings page, and every ended turn keeps its record (provider, model, tokens, tools, duration, how it ended), optionally as one log line. Read more: Budgets and limits.

The agent_limits rows on an operator page from Filament Agents: platform defaults, two workspace rows on different plans and one user with the assistant switched off

Tenancy

Tell the package what a workspace is and how the current one is found:

Set the MCP path with the workspace in it ('mcp' => ['path' => 'mcp/{tenant}']) and the middleware looks the workspace up by its slug, checks the person's membership and the token's tenant:{slug} ability, and enters it before any tool runs. A workspace can bring its own provider key through credentialsUsing(). For a database-per-tenant app set 'run_migrations' => false, publish the migrations, keep create_agent_limits_table central and move the chat tables next to your tenant migrations. Read more: Tenancy.

Configuration

Read more: Configuration.

Documentation

Testing

In your own app, fake the model with Assistant::fake([...]) and drive tools through AcmeServer::tool(ToolClass::class, [...]). Never call a provider from tests. Read more: Testing.

Changelog

See the changelog.

Security vulnerabilities

This package lets a model act inside your app, so we take reports seriously. Please e-mail Security page.

Credits

License

MIT. See the license file.


All versions of agents with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/ai Version ^1.0
laravel/framework Version ^13.0
laravel/mcp Version ^1.0
laravel/sanctum Version ^4.0
spatie/laravel-package-tools Version ^1.93
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package packstub/agents contains the following files

Loading the files please wait ...