pub struct HttpAgentProvider<A: HttpAgentAdapter> { /* private fields */ }Expand description
Generic HTTP provider that wraps any HttpAgentAdapter.
Implements AgentProvider by delegating request construction and response
parsing to the adapter while handling the HTTP transport, timeout, and
agentic execution loop.
When a ToolRegistry is attached via with_tools,
the provider runs a multi-turn agentic loop: executing tool calls locally
and feeding results back to the model until it produces a final response
(or hits max_turns / max_budget_usd limits).
Without a registry, the provider behaves as single-turn (backward-compatible).
Steps that need different tools pick a named profile registered with
with_tool_profile.
Implementations§
Source§impl<A: HttpAgentAdapter> HttpAgentProvider<A>
impl<A: HttpAgentAdapter> HttpAgentProvider<A>
Sourcepub fn with_tools(self, registry: ToolRegistry) -> Self
pub fn with_tools(self, registry: ToolRegistry) -> Self
Attach the default tool registry to enable multi-turn agentic execution.
The default tools go to every step that selects no tool profile. When tools are selected, the provider will:
- Include the tools in every request (OpenAI
toolsformat). - Execute tool calls returned by the model.
- Loop until the model produces a final response or limits are hit.
Sourcepub fn with_tool_profile(
self,
profile: ToolProfile,
registry: ToolRegistry,
) -> Self
pub fn with_tool_profile( self, profile: ToolProfile, registry: ToolRegistry, ) -> Self
Register a named tool profile that steps select with
AgentConfig::tool_profile. Call it once per profile.
A step only sees the tools of the profile it selects, and only those
can run. To share an MCP server between profiles without opening it
twice, see register_shared_mcp_tools (feature tool-mcp).
§Panics
Panics if profile is already registered.
§Examples
use ironflow_core::provider::ToolProfile;
use ironflow_core::providers::http::HttpAgentProvider;
use ironflow_core::providers::http::adapter::HttpAgentAdapter;
use ironflow_core::providers::http::tools::ToolRegistry;
const SUGGESTION: ToolProfile = ToolProfile::new("suggestion");
const BUG: ToolProfile = ToolProfile::new("bug");
fn with_profiles<A: HttpAgentAdapter>(provider: HttpAgentProvider<A>) -> HttpAgentProvider<A> {
provider
.with_tool_profile(SUGGESTION, ToolRegistry::new())
.with_tool_profile(BUG, ToolRegistry::new())
}Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Override the request timeout.
Trait Implementations§
Source§impl<A: HttpAgentAdapter> AgentProvider for HttpAgentProvider<A>
impl<A: HttpAgentAdapter> AgentProvider for HttpAgentProvider<A>
Source§fn invoke_with_logs<'a>(
&'a self,
config: &'a AgentConfig,
log_sink: Arc<dyn LogSink>,
) -> InvokeFuture<'a>
fn invoke_with_logs<'a>( &'a self, config: &'a AgentConfig, log_sink: Arc<dyn LogSink>, ) -> InvokeFuture<'a>
Same as invoke, and records on log_sink
the tool profile of the step with the tools it exposes.
Source§fn invoke<'a>(&'a self, config: &'a AgentConfig) -> InvokeFuture<'a>
fn invoke<'a>(&'a self, config: &'a AgentConfig) -> InvokeFuture<'a>
Source§fn release_run<'a>(&'a self, run_id: &'a str) -> ReleaseFuture<'a>
fn release_run<'a>(&'a self, run_id: &'a str) -> ReleaseFuture<'a>
run_id left running
outside the worker process, before the run executes again. Read more