systemprompt-provider-contracts 0.2.2

Provider trait contracts for systemprompt.io AI governance infrastructure. LlmProvider, ToolProvider, JobContext and friends — swap Anthropic, OpenAI, Gemini, and local models at profile level.
Documentation

Production infrastructure for AI agents

Website · Documentation · Guides · Core · Template · Discord


systemprompt-provider-contracts

Crates.io Docs.rs License: BSL-1.1

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

Type Description
LlmProvider Trait for LLM chat completions
ToolProvider Trait for tool discovery and execution
Job Trait for background job execution
TemplateProvider Trait for template loading
ComponentRenderer Trait for component rendering
PageDataProvider Trait for page data injection
TemplateDataExtender Trait for extending template context

Usage

[dependencies]
systemprompt-provider-contracts = "0.2.1"
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> {
        // Implementation
        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
inventory Compile-time registration
serde Serialization

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.