Skip to main content

Module imp_session

Module imp_session 

Source
Expand description

High-level session API for driving imp programmatically.

ImpSession is the primary public interface for embedding imp in other Rust programs, building custom UIs, or driving agents from orchestrators. It wires together config, auth, model resolution, agent construction, session persistence, and the event stream — eliminating the boilerplate that each run mode (interactive, print, headless, RPC) otherwise duplicates.

§Example

use imp_core::imp_session::{ImpSession, SessionOptions, SessionChoice};

let mut session = ImpSession::create(SessionOptions {
    cwd: std::env::current_dir()?,
    ..Default::default()
}).await?;

session.prompt("What files are in the current directory?").await?;

while let Some(event) = session.recv_event().await {
    println!("{event:?}");
}

Structs§

ImpSession
A fully wired agent session.
ResolvedRuntimeConnection
RuntimeConnectionIntent
SessionOptions
Configuration for creating an ImpSession.

Enums§

SessionChoice
How to initialize the session file.

Functions§

resolve_runtime_connection
Resolve the model-first runtime connection (model id + provider route/surface) shared by CLI and session startup.