pub struct AccountAwareProvider { /* private fields */ }Expand description
An AgentProvider that runs each invocation under a Provider Account.
See the module documentation.
Implementations§
Source§impl AccountAwareProvider
impl AccountAwareProvider
Sourcepub fn new(inner: Arc<dyn AgentProvider>, store: Arc<dyn Store>) -> Self
pub fn new(inner: Arc<dyn AgentProvider>, store: Arc<dyn Store>) -> Self
Wrap inner, reading accounts from store, with the
LeastUtilized strategy, the ClaudeSubscriptionKind kind and a
capacity wait of DEFAULT_MAX_CAPACITY_WAIT.
§Examples
See the module documentation.
Sourcepub fn with_strategy(self, strategy: Arc<dyn AccountStrategy>) -> Self
pub fn with_strategy(self, strategy: Arc<dyn AccountStrategy>) -> Self
Sourcepub fn with_max_capacity_wait(self, wait: Duration) -> Self
pub fn with_max_capacity_wait(self, wait: Duration) -> Self
Longest time a step waits for provider capacity when it sets no
AgentConfig::max_capacity_wait of its own.
Duration::ZERO fails such steps at once with
AgentError::NoCapacity.
§Examples
use std::sync::Arc;
use std::time::Duration;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_engine::accounts::AccountAwareProvider;
use ironflow_store::memory::InMemoryStore;
let provider = AccountAwareProvider::new(
Arc::new(ClaudeCodeProvider::new()),
Arc::new(InMemoryStore::new()),
)
.with_max_capacity_wait(Duration::from_secs(3600));Sourcepub fn with_kind(self, kind: Arc<dyn AccountKind>) -> Self
pub fn with_kind(self, kind: Arc<dyn AccountKind>) -> Self
Register an additional account kind (or replace one with the same id).
§Examples
use std::sync::Arc;
use ironflow_core::account::ClaudeSubscriptionKind;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_engine::accounts::AccountAwareProvider;
use ironflow_store::memory::InMemoryStore;
let provider = AccountAwareProvider::new(
Arc::new(ClaudeCodeProvider::new()),
Arc::new(InMemoryStore::new()),
)
.with_kind(Arc::new(ClaudeSubscriptionKind::with_api_base("http://proxy:8080")));Trait Implementations§
Source§impl AgentProvider for AccountAwareProvider
impl AgentProvider for AccountAwareProvider
Source§fn invoke<'a>(&'a self, config: &'a AgentConfig) -> InvokeFuture<'a>
fn invoke<'a>(&'a self, config: &'a AgentConfig) -> InvokeFuture<'a>
Execute a single agent invocation with the given configuration. Read more
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>
Execute an agent invocation with real-time log streaming. Read more
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>
Stop whatever a previous execution of the run
run_id left running
outside the worker process, before the run executes again. Read moreSource§fn account_kind(&self) -> Option<&'static str>
fn account_kind(&self) -> Option<&'static str>
The Provider Account kind whose credential this provider can inject. Read more
Source§fn account_kind_for(&self, config: &AgentConfig) -> Option<&'static str>
fn account_kind_for(&self, config: &AgentConfig) -> Option<&'static str>
The Provider Account kind of the credential this provider would use
for this specific
config. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for AccountAwareProvider
impl !UnwindSafe for AccountAwareProvider
impl Freeze for AccountAwareProvider
impl Send for AccountAwareProvider
impl Sync for AccountAwareProvider
impl Unpin for AccountAwareProvider
impl UnsafeUnpin for AccountAwareProvider
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
Mutably borrows from an owned value. Read more