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.
- Resolved
Runtime Connection - Runtime
Connection Intent - Session
Options - Configuration for creating an
ImpSession.
Enums§
- Session
Choice - 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.