Skip to main content

sage_runtime/
lib.rs

1//! Runtime library for compiled Sage programs.
2//!
3//! This crate provides the types and functions that generated Rust code
4//! depends on. It handles:
5//!
6//! - Agent spawning and lifecycle
7//! - Message passing between agents
8//! - LLM inference calls
9//! - RFC-0011: Tool execution (Http, Fs, etc.)
10//! - RFC-0012: Mock infrastructure for testing
11//! - Tracing and observability
12//! - Error handling
13
14#![forbid(unsafe_code)]
15
16mod agent;
17mod error;
18mod llm;
19pub mod mock;
20pub mod stdlib;
21pub mod tools;
22pub mod tracing;
23
24pub use agent::{spawn, AgentContext, AgentHandle};
25pub use error::{ErrorKind, SageError, SageResult};
26pub use llm::LlmClient;
27pub use mock::{MockLlmClient, MockQueue, MockResponse};
28pub use tools::{HttpClient, HttpResponse};
29pub use tracing as trace;
30
31/// Prelude for generated code.
32pub mod prelude {
33    pub use crate::agent::{spawn, AgentContext, AgentHandle};
34    pub use crate::error::{ErrorKind, SageError, SageResult};
35    pub use crate::llm::LlmClient;
36    pub use crate::mock::{MockLlmClient, MockQueue, MockResponse};
37    pub use crate::tools::{HttpClient, HttpResponse};
38    pub use crate::tracing as trace;
39}