synwire-core
The foundational trait layer for the Synwire AI framework. Contains every public trait and shared type; zero concrete implementations, zero unsafe code.
What this crate provides
BaseChatModel—invoke,batch,stream,model_type,bind_tools; the primary interface for all chat LLMsBaseLLM— text-completion (single string in, single string out)Embeddings—embed_documents,embed_query; implemented by OpenAI and Ollama providersVectorStore— document storage with similarity searchTool/StructuredTool— callable tools with JSON Schema input validationRunnableCore— universal composition primitive usingserde_json::ValueI/OOutputParser— typed output parsing from model responsesDocumentLoader— async document ingestionAgentNode— agent turn logic returningDirectiveResultExecutionStrategy— controls how the runner sequences agent turnsBackendProtocol— file, shell, HTTP, and process operations as algebraic effectsMiddleware— applied before each agent turn to augment contextPlugin— stateful component with lifecycle hooksSessionManager— session CRUD: create, get, update, delete, list, fork, rewind, tagMcpTransport— MCP protocol transport (stdio, HTTP, in-process)
Quick start
[]
= "0.1"
[]
= "0.1"
Invoke a FakeChatModel (no network required):
use BaseChatModel;
use FakeChatModel;
async
Implement a custom Tool:
use ;
use SynwireError;
use BoxFuture;
Feature flags
| Flag | Enables |
|---|---|
retry |
reqwest-retry middleware for automatic retries on transient HTTP errors |
http |
reqwest HTTP client (needed by provider crates) |
tracing |
tracing spans on all async operations |
event-bus |
Internal event bus for cross-component messaging |
batch-api |
Batch request support for LLM providers that offer it |
Crates that implement these traits
| Crate | Implements |
|---|---|
synwire-llm-openai |
BaseChatModel, Embeddings |
synwire-llm-ollama |
BaseChatModel, Embeddings |
synwire-agent |
ExecutionStrategy, Vfs, Middleware, SessionManager, McpTransport |
synwire-checkpoint |
BaseCheckpointSaver, BaseStore |
synwire-test-utils |
BaseChatModel (FakeChatModel), Embeddings (FakeEmbeddings) |