Skip to main content

Module parking

Module parking 

Source
Expand description

Custom tool parking lot for the managed agent runtime.

When the agent emits a custom_tool_use event, the session loop parks execution until the client delivers a result (or timeout elapses). This module implements that channel-based wait mechanism.

§Architecture

Internally, each parked tool call gets a tokio::sync::oneshot channel. The ToolParkingLot::park method creates the sender, stores it, and awaits the receiver with a timeout. ToolParkingLot::deliver looks up the sender and pushes the content through.

§Example

use std::time::Duration;
use adk_managed::parking::ToolParkingLot;
use adk_managed::types::ContentBlock;

let lot = ToolParkingLot::new(Duration::from_secs(300));

// In the session loop task:
let result = lot.park("tool_use_abc").await?;

// In the event dispatch task:
lot.deliver("tool_use_abc", vec![ContentBlock::Text { text: "done".into() }]).await?;

Structs§

ToolParkingLot
A parking lot for custom tool calls awaiting client-delivered results.