Sleep
Pauses the agent for a bounded number of seconds. Cancelling the enclosing invocation aborts the sleep immediately rather than waiting for the full duration, so a long timer never ties up a session the caller has moved on from.
Supported in: Node.js, modern browsers (TypeScript); all platforms (Python).
The maximum duration is configurable at construction (default: 60 seconds) and
cannot be raised by the model. Negative, NaN, infinite, non-numeric, and
boolean durations are rejected at the tool boundary.
Example:
import { Agent } from '@strands-agents/sdk'import { sleep } from '@strands-agents/sdk/vended-tools/sleep'
const agent = new Agent({ tools: [sleep],})await agent.invoke('Pause for two seconds, then continue.')from strands import Agentfrom strands.vended_tools import sleep
agent = Agent(tools=[sleep])agent("Pause for two seconds, then continue.")Custom maximum:
import { Agent } from '@strands-agents/sdk'import { makeSleep } from '@strands-agents/sdk/vended-tools/sleep'
const shortSleep = makeSleep({ maxDuration: 5 })const agent = new Agent({ tools: [shortSleep] })from strands import Agentfrom strands.vended_tools import make_sleep
short_sleep = make_sleep(max_duration=5)agent = Agent(tools=[short_sleep])