#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
extern crate self as serve;
#[cfg(feature = "a2a")]
mod a2a;
#[cfg(feature = "ag-ui")]
mod ag_ui;
mod agent;
mod app;
mod channel;
mod cli;
mod config;
mod connection;
mod cx;
mod eval;
mod gateway;
mod host;
mod hosting;
mod manifest;
mod registry;
mod scheduler;
mod server;
mod store;
#[cfg(test)]
mod wire_tests;
pub use agent::{Agent, AgentBuilder, Instructions, Markdown};
pub use app::{App, AppBuilder, Mode};
pub use channel::{Channel, ChannelEvent, Inbound, Slack, Webhook};
pub use cli::start;
pub use config::{AppConfig, SandboxKind};
pub use connection::{McpServer, Secret};
pub use cx::{Cx, DeliveryTarget, StartSession};
pub use eval::{EvalCx, EvalReport, EvalResult, OnApproval, TurnCheck, TurnRecord};
pub use hosting::{MicroVm, Server, ServerBuilder, data_dir};
pub use manifest::Manifest;
pub use serve_macros::{agent, channel, connection, eval, schedule, tool};
pub mod sim {
pub use everruns::{LlmSimConfig, OnExhausted, SimToolCall, SimTurn};
pub fn script(turns: impl IntoIterator<Item = SimTurn>) -> LlmSimConfig {
LlmSimConfig::scripted(turns.into_iter().collect()).with_on_exhausted(OnExhausted::Loop)
}
pub fn call(name: impl Into<String>, arguments: serde_json::Value) -> SimTurn {
SimTurn::ToolCalls(vec![SimToolCall {
name: name.into(),
arguments,
id: None,
}])
}
pub fn reply(text: impl Into<String>) -> SimTurn {
SimTurn::Assistant(text.into())
}
}
pub type Error = anyhow::Error;
pub type Result<T = (), E = Error> = std::result::Result<T, E>;
pub mod prelude {
pub use crate::{
Agent, App, Channel, Cx, DeliveryTarget, EvalCx, McpServer, Result, Secret, Slack, Webhook,
agent, channel, connection, eval, md, schedule, tool,
};
pub use anyhow::{anyhow, bail, ensure};
pub use serde::{Deserialize, Serialize};
pub use serde_json::json;
}
#[macro_export]
macro_rules! assets {
() => {
include!(concat!(env!("OUT_DIR"), "/serve_assets.rs"));
$crate::__private::inventory::submit! {
$crate::__private::AppInfoRegistration {
name: env!("CARGO_PKG_NAME"),
version: env!("CARGO_PKG_VERSION"),
}
}
};
}
#[macro_export]
macro_rules! md {
($path:literal) => {
$crate::Markdown::__embedded(
$path,
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/agent/", $path)),
concat!(env!("CARGO_MANIFEST_DIR"), "/agent/", $path),
)
};
}
#[doc(hidden)]
pub mod __private {
pub use crate::registry::*;
pub use futures::future::BoxFuture;
pub use inventory;
pub use schemars;
pub use serde;
pub use serde_json::Value;
}