Skip to main content

Crate ingot_runtime

Crate ingot_runtime 

Source
Expand description

The reference interpreter for the Ingot Agent IR.

This crate is the executable definition of what an IR document means. It is deliberately narrow — see RFC-0002 and ADR-0002. It has no context management, no provider routing, no session state and no orchestration features, because its job is to make the IR’s semantics precise and testable, not to be a good place to host an agent.

use ingot_runtime::{run, RunOptions, ScriptedProvider, DenyAllTools, CollectingSink};
use std::collections::BTreeMap;

let ir = ingot_ir::AgentIr::from_json(&std::fs::read_to_string("Brief.ir.json")?)?;
let mut provider = ScriptedProvider::new(vec![serde_json::json!("# Brief\n\n...")]);
let mut tools = DenyAllTools;
let mut events = CollectingSink::default();

let report = run(
    &ir,
    &BTreeMap::new(),
    &mut provider,
    &mut tools,
    &mut events,
    RunOptions {
        inputs: [("topic".to_string(), serde_json::json!("compilers"))].into(),
        ..RunOptions::default()
    },
)?;

println!("{}", String::from_utf8_lossy(&report.outputs["brief"].to_bytes()));

Re-exports§

pub use cassette::invocation_digest;
pub use cassette::load_directory;
pub use cassette::Cassette;
pub use cassette::Interaction;
pub use cassette::RecordingProvider;
pub use cassette::RecordingTools;
pub use cassette::ReplayProvider;
pub use cassette::ReplayToolHost;
pub use cassette::ScriptedProvider;
pub use cassette::ToolExchange;
pub use cassette::CASSETTE_VERSION;
pub use cassette::SUPPORTED_CASSETTE_VERSIONS;
pub use catalogue::ModelConfig;
pub use catalogue::ProviderConfig;
pub use catalogue::ProviderKind;
pub use events::Artifact;
pub use events::CollectingSink;
pub use events::EventSink;
pub use events::NullSink;
pub use events::RunEvent;
pub use events::TeeSink;
pub use events::VerifyOutcome;
pub use provider::CompletionRequest;
pub use provider::CompletionResponse;
pub use provider::ModelProvider;
pub use provider::ModelSelection;
pub use provider::ProviderError;
pub use provider::Usage;
pub use router::RoutingProvider;
pub use snapshot::artifact_digest;
pub use snapshot::Resumption;
pub use snapshot::SnapshotError;
pub use tools::ApprovalHandler;
pub use tools::ApprovalMode;
pub use tools::ApprovalRequest;
pub use tools::DenyAllTools;
pub use tools::ScriptedApprovals;
pub use tools::StaticToolHost;
pub use tools::ToolError;
pub use tools::ToolHost;
pub use tools::ToolInvocation;

Modules§

cassette
Recorded model exchanges, for deterministic offline runs.
catalogue
Which model services this machine can reach.
events
The normalised event stream.
price
What a model call costs, so a cost budget can be charged.
provider
The model provider interface.
router
Sending each call to the provider the artifact asked for.
schema
Ingot types to JSON Schema.
snapshot
A run that stopped, in a form that can be continued.
tools
Tool hosting and approval.

Structs§

RunOptions
RunReport
What a completed run produced.

Enums§

RunError
Why a run stopped.

Functions§

run
Execute an agent.

Type Aliases§

AgentRegistry
Other agents this run may call.