pub struct AgyBridge { /* private fields */ }Expand description
Primary entry point for the Antigravity bridge.
Wraps the runtime and provides a clean Rust API for creating agents.
§Example
// Zero-config:
// let bridge = AgyBridge::builder().build()?;
// With custom settings:
let bridge = AgyBridge::builder().channel_capacity(128).build()?;
// Create an agent (simple):
// let agent = bridge.agent(AgentConfig::default()).await?;
// Create an agent with tools and hooks:
// let agent = bridge.agent(config)
// .tools(registry)
// .hooks(hooks)
// .await?;
let answer = agent.chat("Hello!").await?.text().await?;Implementations§
Source§impl AgyBridge
impl AgyBridge
Sourcepub fn builder() -> AgyBridgeBuilder
pub fn builder() -> AgyBridgeBuilder
Sourcepub fn agent(&self, config: AgentConfig) -> AgentBuilder<'_>
pub fn agent(&self, config: AgentConfig) -> AgentBuilder<'_>
Begin building a new agent on this bridge.
Returns an AgentBuilder that can be directly .awaited for the
simple case, or chained with .tools() and
.hooks() before awaiting.
§Examples
// Simple — no tools or hooks:
let agent = bridge.agent(AgentConfig::default()).await?;
// With tools:
// let agent = bridge.agent(config).tools(registry).await?;
// With tools and hooks:
// let agent = bridge.agent(config).tools(registry).hooks(hooks).await?;Sourcepub fn default_agent(&self) -> AgentBuilder<'_>
pub fn default_agent(&self) -> AgentBuilder<'_>
Sourcepub async fn active_agent_count(&self) -> Result<usize, Error>
pub async fn active_agent_count(&self) -> Result<usize, Error>
Return the number of agents currently live on this bridge.
Counts agents that have been created but not yet shut down or dropped.
Because a bridge owns a single runtime with a single agent registry,
this reflects exactly the agents belonging to this bridge — it is
unaffected by agents on other AgyBridge instances.
Useful for observability and for asserting clean teardown: once every agent has been shut down or dropped, the count returns to zero.
§Errors
Returns error::Error if the runtime thread has exited.