Summary
The `Tool` trait's `execute()` method has no per-call timeout parameter. If an agent sends a script that runs too long, there's no way for the orchestrating system to abort it except by dropping the future.
Current state
- Resource limits (max_commands, max_iterations) are set on the `BashTool` instance at build time
- `timeout` builtin exists for wrapping individual commands
- But no way for the tool caller to say "this entire call must complete in N seconds"
Proposed API
```rust
pub struct ToolRequest {
pub commands: String,
pub timeout_ms: Option, // NEW: per-call timeout
}
```
Or alternatively:
```rust
async fn execute_with_timeout(
&mut self,
req: ToolRequest,
timeout: Duration,
) -> ToolResponse;
```
Use cases
- Agent frameworks with per-tool timeouts (LangChain, CrewAI)
- Preventing runaway scripts in production
- Different timeouts for different task types (quick query vs. data processing)
Acceptance criteria
Summary
The `Tool` trait's `execute()` method has no per-call timeout parameter. If an agent sends a script that runs too long, there's no way for the orchestrating system to abort it except by dropping the future.
Current state
Proposed API
```rust
pub struct ToolRequest {
pub commands: String,
pub timeout_ms: Option, // NEW: per-call timeout
}
```
Or alternatively:
```rust
async fn execute_with_timeout(
&mut self,
req: ToolRequest,
timeout: Duration,
) -> ToolResponse;
```
Use cases
Acceptance criteria