Context
Operations that complete quickly.
Problem
Most tool calls need immediate results to continue the conversation.
Solution
Synchronous execution:
- Immediate: Returns result in same call
- Bounded time: Completes within seconds
- Blocking: Agent waits for response
- Complete result: Full output returned
- Immediate: Returns result in same call
- Bounded time: Completes within seconds
- Blocking: Agent waits for response
- Complete result: Full output returned
Examples
Python
@tool
def get_weather(city: str) -> Weather:
"""Get current weather. Returns immediately."""
return weather_api.current(city) TypeScript
const getWeather = tool({
execute: async ({ city }) => {
return await weatherApi.current(city);
}
}); Considerations
- Most tools should be synchronous
- Set reasonable timeouts (e.g., 30 seconds)
- Use async-job pattern for long operations