pub struct AgentSpec {
pub id: AgentId,
pub config_path: PathBuf,
pub endpoint: String,
pub image: Option<String>,
}Expand description
What to run and how to reach it — the unit of deployment a runtime manages.
Today an agent is a TOML config, so a spec pairs that config path with the
derived AgentId and the endpoint the agent will serve on (used for health
probing). Build one with from_config_path, or
construct the fields directly.
Fields§
§id: AgentIdStable id, derived from the agent’s name (slug). Shared with the registry.
config_path: PathBufPath to the agent’s TOML config, passed to a2a run --config <path>.
endpoint: StringDialable base URL the agent serves on (from AgentConfig::agent_url),
probed to decide RuntimeHealth::Healthy vs RuntimeHealth::Unhealthy.
image: Option<String>The agent’s own image ([runtime] image), where it brings one.
This is how an agent whose handler no TOML can express reaches the
platform: as an image, rather than as a handler name this binary would
have to already know. None means the runtime’s own default — its base
image, or a child a2a run process.
A backend that cannot run an arbitrary image must reject a spec carrying
one with RuntimeError::Unsupported: running the config’s config in
something other than its image gives an agent that starts, answers, and
is not the agent that was deployed.
Implementations§
Source§impl AgentSpec
impl AgentSpec
Sourcepub fn from_config_path(path: impl Into<PathBuf>) -> Result<Self, RuntimeError>
pub fn from_config_path(path: impl Into<PathBuf>) -> Result<Self, RuntimeError>
Derive a spec from a config file, reusing AgentConfig to read the
agent’s name (→ AgentId), bound endpoint and image. Invalid configs
surface as RuntimeError::Config.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentSpec
impl RefUnwindSafe for AgentSpec
impl Send for AgentSpec
impl Sync for AgentSpec
impl Unpin for AgentSpec
impl UnsafeUnpin for AgentSpec
impl UnwindSafe for AgentSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more