Home / Laravel / Toolkit: Reusable AI Tools for the Laravel AI SDK

Toolkit: Reusable AI Tools for the Laravel AI SDK

Toolkit, by Pushpak Chhajed under the Ship Fast Labs banner, is a community catalog of reusable tools for the Laravel AI SDK. The tools live in one monorepo but ship as separate Composer packages, so you install only the ones an agent needs.

One Package per Tool, No Service Providers

Every tool is a class implementing LaravelAiContractsTool — a description(), a handle(), and a schema(). There’s no shared core, no service provider to register, and no published config. You require the package you want, instantiate the tool, and pass it to an agent’s tools():

composer require shipfastlabs/toolkit-calculator
composer require shipfastlabs/toolkit-database
use ShipfastlabsToolkitCalculatorCalculatorTool;
use ShipfastlabsToolkitDatabaseDatabaseQueryTool;
 
$tools = [
new CalculatorTool,
new DatabaseQueryTool,
];

Each tool advertises its purpose through description() and its inputs through schema(), and the model decides when to call it. Results — including errors — come back as strings, so the model can read the failure and recover instead of the request throwing.

Calculator Without eval()

The Calculator tool takes an expression string and evaluates it with a recursive-descent parser rather than PHP’s eval(). It supports +, -, *, /, %, ^ (right-associative exponent), parentheses, unary signs, and decimals. Invalid input, division or modulo by zero, and non-finite results are returned to the model as plain strings rather than thrown. It’s a “pure” tool: no config, no service provider.

Read-Only Database Queries

The Database tool runs a single SQL SELECT and returns matching rows as pretty-printed JSON. Its guardrails are the point:

  • Only a single statement beginning with SELECT (or a WITH … SELECT CTE) is allowed.
  • INSERT, UPDATE, DELETE, DROP, ALTER, and similar keywords are rejected, even inside an otherwise-SELECT statement.
  • Queries containing ; separators are refused.
  • A LIMIT is appended to any query that lacks one.

Configurable tools read from an ai.toolkit.* key you add to the Laravel AI SDK’s existing config/ai.php — there’s no separate config file to publish:

// config/ai.php
 
'toolkit' => [
'database' => [
'connection' => env('TOOLKIT_DATABASE_CONNECTION'),
'max_rows' => (int) env('TOOLKIT_DATABASE_MAX_ROWS', 100),
],
],

Pointing connection at a read-only replica adds another layer of safety, and max_rows caps how many rows come back.

Web Search and Research Providers

Three packages wrap search and research APIs, each with a helper that registers the whole set at once or individual tool classes you can pick from:

  • Exa (toolkit-exa): ExaSearch, ExaFindSimilar, ExaGetContents, and ExaAnswer for embeddings-based web search, similarity lookups, content extraction, and sourced answers with citations.
  • Perplexity (toolkit-perplexity): PerplexitySearch for ranked sources and PerplexityAsk for cited answers across the Sonar models, with web, academic, and sec search modes.
  • Tavily (toolkit-tavily): TavilySearch, TavilyExtract, TavilyCrawl, and TavilyMap for search, content extraction, site crawling, and site mapping.
use ShipfastlabsToolkitExaExa;
 
$tools = Exa::all(); // Collection<int, Tool>

Each provider reads its API key from Laravel’s services config and its optional defaults from ai.toolkit.*. Numeric parameters are clamped to valid ranges, enum parameters fall back to safe defaults, and API errors are caught and returned as strings rather than thrown.

JigsawStack’s Endpoint Library

The JigsawStack package (toolkit-jigsawstack) exposes a tool per endpoint grouped into general, translation, web, vision, audio, and validation categories. That covers sentiment, summary, embeddings, text-to-SQL, time-series prediction, text and image translation, web search, AI scraping, HTML-to-image/PDF, VOCR, object detection, speech-to-text, and NSFW/profanity/spell/spam checks.

Each tool maps to one endpoint and returns the raw JSON response (pretty-printed) so the model can read every field. Requests time out after 60 seconds, and a missing API key returns a clear “not configured” message.

Installation

Pick the tools you need and require them individually — for example:

composer require shipfastlabs/toolkit-calculator
composer require shipfastlabs/toolkit-tavily

The remote-API tools need their provider key in config/services.php (and the matching .env entry); each tool’s documentation page lists the exact config keys and defaults.

Browse the full catalog on the Toolkit website, and view the source on GitHub.

Source: https://laravel-news.com

Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *