pub struct FoundryAgent { /* private fields */ }Expand description
A SupportsAgentRun that runs a Foundry Prompt Agent over the
Responses API.
Built from a FoundryChatClient plus a PromptAgentDefinition
(name/instructions/model/tools): internally it constructs a core
Agent over that client with the definition applied, and every
SupportsAgentRun method delegates straight through to it.
to_prompt_agent hands back the definition the
agent was built from, so it round-trips through
FoundryAgent::from_definition.
This realizes a Prompt Agent client-side, entirely through the
stateless Responses API — it does not create, fetch, or bind to a
server-hosted agent by id/name on the Foundry Agents control plane
(AIProjectClient.agents.*). Wiring up that control plane, so
FoundryAgent could target a Prompt Agent or Hosted Agent that already
exists on the service (e.g. a future agent_id/with_existing_agent
constructor), is a documented extension point, not implemented here.
Implementations§
Source§impl FoundryAgent
impl FoundryAgent
Sourcepub fn builder(client: FoundryChatClient) -> FoundryAgentBuilder
pub fn builder(client: FoundryChatClient) -> FoundryAgentBuilder
Start building a FoundryAgent over client.
Sourcepub fn from_definition(
client: FoundryChatClient,
definition: PromptAgentDefinition,
) -> Self
pub fn from_definition( client: FoundryChatClient, definition: PromptAgentDefinition, ) -> Self
Build a FoundryAgent directly from a PromptAgentDefinition.
The inner Agent’s id and name are both set to definition.name
(the core AgentBuilder
otherwise defaults id to a random UUID).
Sourcepub fn to_prompt_agent(&self) -> PromptAgentDefinition
pub fn to_prompt_agent(&self) -> PromptAgentDefinition
The PromptAgentDefinition this agent was built from — round-trips
through FoundryAgent::from_definition.
Sourcepub fn inner(&self) -> &Agent
pub fn inner(&self) -> &Agent
The wrapped core Agent, for functionality (e.g. Agent::as_tool)
not exposed directly on FoundryAgent.
Trait Implementations§
Source§impl Clone for FoundryAgent
impl Clone for FoundryAgent
Source§fn clone(&self) -> FoundryAgent
fn clone(&self) -> FoundryAgent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FoundryAgent
impl Debug for FoundryAgent
Source§impl SupportsAgentRun for FoundryAgent
impl SupportsAgentRun for FoundryAgent
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
session: Option<&'life1 mut AgentSession>,
) -> Pin<Box<dyn Future<Output = Result<AgentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
session: Option<&'life1 mut AgentSession>,
) -> Pin<Box<dyn Future<Output = Result<AgentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn run_with_options<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
session: Option<&'life1 mut AgentSession>,
options: AgentRunOptions,
) -> Pin<Box<dyn Future<Output = Result<AgentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_with_options<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
session: Option<&'life1 mut AgentSession>,
options: AgentRunOptions,
) -> Pin<Box<dyn Future<Output = Result<AgentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
AgentRunOptions over
the agent’s build-time defaults. Read moreSource§fn run_stream<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
session: Option<AgentSession>,
options: Option<AgentRunOptions>,
) -> Pin<Box<dyn Future<Output = Result<AgentRunStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run_stream<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
session: Option<AgentSession>,
options: Option<AgentRunOptions>,
) -> Pin<Box<dyn Future<Output = Result<AgentRunStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
AgentResponseUpdates. Read moreSource§fn display_name(&self) -> String
fn display_name(&self) -> String
name if set, else id.