everruns
The application-facing crate for building and running agents with the Everruns Framework.
everruns provides value-first agents, plain model ids, open provider configuration,
typed tools, isolated multi-turn sessions, live events, cancellation, files,
typed lifecycle hooks, MCP, plugins, and context inspection without requiring
a server, worker, or database.
It is the primary library crate in the Everruns ecosystem. Normal Rust applications should start here; focused core, engine, host, provider, and platform crates support the implementation and advanced execution hosts.
Installation
Default features stay offline and include the typed tool macro. Opt into a live provider only when needed:
Offline Quickstart
use ;
async
Model::simulated uses the normal provider/execution path and returns a fixed
response locally. It needs no credential or network connection.
Open Provider Setup
With the openai feature, attach the provider while keeping model identity free
of credentials:
use ;
let agent = builder
.instructions
.provider
.model
.build?;
# Ok::
Custom services use the same open boundary: attach a Provider backed by your
ChatDriver, then select its model with a plain string id. No ModelSpec,
closed model enum, or provider-specific application branch is required.
Typed Tools
use ;
/// Add two integers.
async
let agent = builder
.instructions
.model
.tool
.build?;
# Ok::
The default-enabled macro generates the argument schema and adapter. The
everruns-macros package is an implementation crate re-exported as
everruns::tool; applications do not need to depend on it directly.
Unified Capability Configuration
Every capability uses one scalable builder entrypoint. Typed built-ins,
code-defined packages, open third-party values, plain default-config IDs, and
dynamic JSON references all implement IntoCapability:
use ;
use json;
let weather_definition = new.tool;
let agent = builder
.instructions
.model
.capability
.capability
.capability
.capability
.build?;
# Ok::
CapabilityRef is the explicit database/plugin escape hatch: the Framework
validates its stable open ID and JSON object at build time, and known built-ins
validate their own schemas. Duplicate IDs and code-implementation collisions
are errors, never silent overwrites. Third-party crates can implement the
non-sealed IntoCapability trait without importing everruns-core.
Keep ordinary functions on #[everruns::tool] and .tool(...); a function
tool is not a capability reference.
Sessions, Events, and Cancellation
An agent opens independent live sessions. send accepts a message immediately,
automatically steering an active turn or starting the next turn after
completion. send_and_wait is the request/response convenience. Subscribe
before sending to observe live events, or pass a cancellation token through
RunOptions.
use ;
let session = agent.session;
let mut events = session.events;
let first = session.send.await?;
let turn = first.wait.await?;
let cancel = new;
let options = new.cancel_token;
cancel.cancel;
let stopped = session.run_with.await?;
assert!;
assert!;
while let Some = events.try_recv?
# Ok::
Session::inspect exposes the application-facing context assembled for the
next model call without exposing backend records.
Lifecycle Hooks
Register async handlers on Agent::builder() when application work must be
awaited at an agent, turn, tool, or completion boundary. Handlers receive owned,
typed Framework contexts and never require persisted hook records or runtime
imports. Use session events instead for non-blocking observation.
use ;
let agent = builder
.instructions
.model
.on_agent_start
.on_completion
.build?;
# Ok::
Persistence
By default, conversation history is offline, database-free, and retained for
the lifetime of an Agent and its clones. Keep a typed SessionId and call
Agent::resume; use Session::history().page() for bounded event-derived
reads. The local feature adds a crash-durable canonical event log and session
catalog alongside its real workspace and task/schedule state.
Existing 0.17.x runtime persistence users should follow the runtime migration guide to these event-derived APIs.
What It Provides
- Value-first
Agent, plain model ids, openProvider, and deterministic simulation - Typed and dynamic function tools
- Independent multi-turn
Sessions, typed resume, bounded history, and next-turn context inspection - Live typed events, lossless canonical envelopes, and cancellation
- Session-owned immediate and scheduled work with leased, at-least-once delivery
- Awaited, typed lifecycle hooks with explicit failure isolation
- Editable/read-only files, one trusted workspace, scoped MCP, and plugins
- Optional OpenAI and local profiles without enlarging the offline default
Runnable Examples
The example catalog includes:
workspace_policy— secure workspace scopes with an offline simulatorhello— smallest live-provider programproduction_agent— production-style compositiongithub_monitor --simulate— credential-free typed-tool flowsession_work— offline background work and completion wakescanonical_events— offline lossless event recording and typed renderingsubagents— public-facade delegationobserve_and_cancel— events and cancellationsession_history— offline durable resume and bounded history pageslifecycle_hooks— agent, turn, tool, and completion handlers
Examples are compiled in CI and import only everruns.
Which Crate Should I Use?
| Need | Start with |
|---|---|
| Build and run agents in a Rust application | everruns |
| Implement or configure a focused model provider | everruns plus the provider crate |
| Call a remote Everruns deployment | an Everruns SDK |
| Compose low-level execution backends | everruns plus everruns-host and focused sibling crates |
| Migrate an existing 0.17.x runtime application | the runtime migration guide |
| Operate durable server/worker/UI infrastructure | the Everruns Platform |
Documentation
- Everruns Framework
- Framework quickstart
- Workspace security
- Models and providers
- Tools and macros
- Sessions
- Session history and resume
- Persistence
- Session work and wakes
- Events and cancellation
- Lifecycle hooks
- Canonical events
- Runtime migration
- API reference
Extend agents
Use #[everruns::tool] for an ordinary typed async function. Reusable packages
that need multiple typed tools, capability metadata, execution context,
progress, or call-scoped cancellation use the curated everruns::capability
SPI and the same AgentBuilder::capability entrypoint.
See the Framework capability-authoring guide and the runnable advanced example.
License
Licensed under the MIT License.