77 releases (15 breaking)
Uses new Rust 2024
| new 0.15.2 | Jun 8, 2026 |
|---|---|
| 0.14.6 | Jun 3, 2026 |
| 0.1.19 | Mar 31, 2026 |
#1 in #mcp
978 downloads per month
Used in 29 crates
(12 directly)
165KB
4K
SLoC
Production infrastructure for AI agents
Website · Documentation · Guides · Core · Template · Discord
systemprompt-provider-contracts
Provider trait contracts for systemprompt.io AI governance infrastructure. LlmProvider, ToolProvider, JobContext, and friends — swap Anthropic, OpenAI, Gemini, and local models at profile level. Implementations live in domain crates while contracts remain in the shared layer for maximum composability.
Layer: Shared — foundational types/traits with no dependencies on other layers. Part of the systemprompt-core workspace.
Overview
Defines the core provider trait contracts used throughout systemprompt.io. These traits establish the interface boundaries for LLM providers, tool executors, job runners, template providers, and component renderers. Implementations live in domain crates while contracts remain in the shared layer for maximum composability.
Architecture
| Module | Trait / Type | Purpose |
|---|---|---|
llm |
LlmProvider, ToolExecutor, ChatRequest, ChatResponse, ChatStream |
LLM chat completions, streaming, and tool-call execution |
tool |
ToolProvider, ToolDefinition, ToolCallRequest, ToolCallResult, ToolContent |
Tool discovery and invocation |
job |
Job, JobContext, JobResult |
Background job execution |
template |
TemplateProvider, TemplateDefinition, TemplateSource |
Template loading and resolution |
component |
ComponentRenderer, ComponentContext, PartialTemplate, RenderedComponent |
Component rendering and partial sources |
page |
PageDataProvider, PageContext |
Page data injection |
page_prerenderer |
PagePrerenderer, PagePrepareContext, PageRenderSpec |
Static page prerendering |
extender |
TemplateDataExtender, ExtenderContext, ExtendedData |
Template context extension |
frontmatter |
FrontmatterProcessor, FrontmatterContext |
Frontmatter parsing and transformation |
content_data |
ContentDataProvider, ContentDataContext |
Content data injection |
rss |
RssFeedProvider, RssFeedSpec, RssFeedItem, RssFeedMetadata |
RSS feed generation |
sitemap |
SitemapProvider, SitemapSourceSpec, SitemapUrlEntry, SitemapAlternate |
Sitemap generation with placeholder mapping |
web_config |
WebConfig, BrandingConfig, ColorsConfig, TypographyConfig, LayoutConfig, … |
Declarative web/theme configuration loaded from YAML |
error |
ProviderError, ProviderResult |
Shared error type for non-LLM, non-tool providers |
Usage
[dependencies]
systemprompt-provider-contracts = "0.14.0"
use systemprompt_provider_contracts::{
LlmProvider, ChatRequest, ChatResponse, LlmProviderResult,
ToolProvider, ToolDefinition, ToolCallRequest, ToolCallResult,
};
use async_trait::async_trait;
struct MyLlmProvider;
#[async_trait]
impl LlmProvider for MyLlmProvider {
async fn chat(&self, request: ChatRequest) -> LlmProviderResult<ChatResponse> {
todo!()
}
}
use systemprompt_provider_contracts::web_config::WebConfig;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let yaml = std::fs::read_to_string("services/web/config.yaml")?;
let web: WebConfig = serde_yaml::from_str(&yaml)?;
println!("site title: {}", web.branding.site_title);
Ok(())
}
Dependencies
Internal
| Crate | Purpose |
|---|---|
systemprompt-identifiers |
Typed identifiers |
External
| Crate | Purpose |
|---|---|
async-trait |
Async trait support for dyn-compatible providers |
futures |
Stream primitives for ChatStream |
inventory |
Compile-time provider registration |
serde, serde_json, serde_yaml |
Request/response and config (de)serialization |
thiserror |
Typed error enums |
chrono |
Timestamps in feed and sitemap entries |
License
BSL-1.1 (Business Source License). Source-available for evaluation, testing, and non-production use. Production use requires a commercial license. Each version converts to Apache 2.0 four years after publication. See LICENSE.
systemprompt.io · Documentation · Guides · Live Demo · Template · crates.io · docs.rs · Discord
Shared layer · Own how your organization uses AI.
Dependencies
~2.8–4.5MB
~81K SLoC