spawningpool
Create hyper-specific, 0-waste agents.
spawningpool is the core library behind the spawningpool
CLI. A specialist is a saved template of (provider, model, system prompt, tools) that you instantiate with a prompt and run. This crate gives you the
domain types, the on-disk registry, the provider clients (Anthropic and any
OpenAI-compatible endpoint), and the agentic run loop that drives a specialist
against a prompt — executing its tools and feeding results back until it settles.
If you just want the command-line tool, install
spawningpool-cli instead.
Install
What's in the box
domain— the entity model:Registry,ProviderDef,ModelDef,Specialist, andToolDef, with reference resolution between them.store— load and save the JSON registry on disk.tools— resolve executable scripts in thetools/folder intoToolDefs.ai— theClient, provider adapters, message/streaming types, and optional JSON-Schema validation of tool calls.run_specialist— the front-end-agnostic agentic loop, which reports progress through aRunEventobserver you supply rather than writing to stdout itself.
Example
Load the registry the spawningpool CLI persists, then run a specialist and print its
output as it streams:
use Client;
use ;
async
Forcing structured output
A Specialist with a constraint forces one call to a named tool, making the
tool's parameters a structured-output schema. By default this uses the
tool-call trick: rather than relying on grammar-constrained decoding (which
not every endpoint supports), the request forces a tool call whose arguments are
the structured output — tool_choice on OpenAI-compatible endpoints, native
forced tool choice on Anthropic — so it works on every provider.
Setting constrained_decoding (from a ProviderDef declared with
--constrained-decoding) upgrades to true grammar-constrained decoding. Only the
OpenAI-compatible adapter honors it; the Anthropic adapter always uses native
forced tool choice.
Documentation
- API docs: https://docs.rs/spawningpool
- Guides (quickstart, CLI reference, writing tools, configuration):
the
docs/folder
License
Licensed under the MIT license.