Standard library only · runs in your browser
Tools fail all the time: a city with no data, a divide by zero, a tool name the model invented. A production dispatcher turns every one of those into an observation the model can read. It never raises one that kills the run.
Implement dispatch(call), where call is {"tool": name, "arguments": {...}} (what stage 1 returns). Look the tool up in the provided TOOLS registry and always return a string:
error: unknown tool 'NAME'. available tools: add, divide, get_weather, lookup_doc (names sorted, comma-separated)validate_arguments, provided below): error: invalid arguments for 'NAME': followed by the errors joined with ; error: NAME raised ExceptionType: messagejson.dumps(result)dispatch(call: dict) -> str