switon / ai
Stable AI contracts for Switon Framework (shared primitives; not providers or agent loop)
v1.0.0
2026-08-22 14:29 UTC
Requires
- php: >=8.3
- ext-mbstring: *
- psr/container: ^2.0
- switon/core: ^1.0
- switon/event: ^1.0
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- switon/testing: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Stable AI wire contracts for Switon — shared primitives above core, below providers (llm), tool registry (tooling), catalog (agents), skill catalog (skill), thread, MCP client, and agency.
Highlights
- Wire contracts: messages, tool calls, streaming fragments, and token counts.
- Boundary: providers, the tool registry, catalogs, thread storage, and the agent loop stay outside.
- Inbox: one piece of mail, the model id, and the chosen effort.
- Suspend: a turn can wait for a tool reply, a host review, or a retry, then continue.
- Drop a turn: remove it from working memory.
Installation
composer require switon/ai
Quick Start
use Switon\Ai\AgentInterface; use Switon\Ai\Envelope; /** @var AgentInterface $agent */ $agent->deliver(Envelope::of('hi', 'main')); $turn = $agent->run(Envelope::of('hi', 'main'));
Docs: https://github.com/switon-php/ai/blob/main/docs/README.md
License
MIT.