pub struct ConcurrencyPermit { /* private fields */ }Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling RAII guard that releases semaphore permits on drop.
A ConcurrencyPermit holds at most one global permit and one per-tool permit.
When the permit is dropped, the underlying semaphore slots are released,
allowing queued tool calls to proceed.
§Example
ⓘ
use adk_core::{ToolConcurrencyConfig, ToolConcurrencyManager};
let config = ToolConcurrencyConfig {
max_concurrency: Some(3),
..Default::default()
};
let manager = ToolConcurrencyManager::new(&config);
let permit = manager.acquire("my_tool").await.unwrap();
// Tool executes while permit is held...
drop(permit); // Semaphore slot releasedAuto Trait Implementations§
impl Freeze for ConcurrencyPermit
impl RefUnwindSafe for ConcurrencyPermit
impl Send for ConcurrencyPermit
impl Sync for ConcurrencyPermit
impl Unpin for ConcurrencyPermit
impl UnsafeUnpin for ConcurrencyPermit
impl UnwindSafe for ConcurrencyPermit
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