Skip to main content

Crate sage_runtime

Crate sage_runtime 

Source
Expand description

Runtime library for compiled Sage programs.

This crate provides the types and functions that generated Rust code depends on. It handles:

  • Agent spawning and lifecycle
  • Message passing between agents
  • LLM inference calls
  • RFC-0011: Tool execution (Http, Fs, etc.)
  • RFC-0012: Mock infrastructure for testing
  • Tracing and observability
  • Error handling
  • v2.0: Persistence for @persistent agent beliefs
  • v2.0: Supervision trees for agent lifecycle management
  • Phase 3: Session types for protocol verification

Re-exports§

pub use mock::try_get_mock;
pub use mock::with_mock_tools;
pub use mock::MockLlmClient;
pub use mock::MockQueue;
pub use mock::MockResponse;
pub use mock::MockToolRegistry;
pub use persistence::CheckpointStore;
pub use persistence::Persisted;
pub use session::ProtocolStateMachine;
pub use session::ProtocolViolation;
pub use session::SenderHandle;
pub use session::SessionId;
pub use session::SessionRegistry;
pub use session::SessionState;
pub use session::SharedSessionRegistry;
pub use supervisor::RestartConfig;
pub use supervisor::RestartPolicy;
pub use supervisor::Strategy;
pub use supervisor::Supervisor;
pub use tools::DatabaseClient;
pub use tools::DbRow;
pub use tools::FsClient;
pub use tools::HttpClient;
pub use tools::HttpResponse;
pub use tools::ShellClient;
pub use tools::ShellResult;
pub use tracing as trace;

Modules§

mock
Mock infrastructure for the Sage testing framework (RFC-0012).
persistence
Persistence support for @persistent agent beliefs.
prelude
Prelude for generated code.
session
Phase 3: Session types infrastructure for protocol verification.
stdlib
Standard library functions for Sage.
supervisor
Supervision tree implementation for Sage v2.
tools
RFC-0011: Tool implementations for Sage agents.
tracing
Tracing support for Sage programs.

Structs§

AgentContext
Context provided to agent handlers.
AgentHandle
Handle to a spawned agent.
LlmClient
Client for making LLM inference calls.
LlmConfig
Configuration for the LLM client.
Message
A message that can be sent to an agent.

Enums§

ErrorKind
RFC-0007: Error kind classification for Sage errors.
SageError
Error type for Sage runtime errors.

Functions§

spawn
Spawn an agent and return a handle to it.
spawn_with_llm_config
Spawn an agent with a custom LLM configuration.

Type Aliases§

SageResult
Result type for Sage operations.