Skip to main content
Any Restate handler can be a tool. Each tool call is a durable call to the handler, which runs as its own invocation, with its own journal and retries. handlerTool exposes one handler with the arguments you define. serviceTool exposes every handler of a service, and the model chooses the handler:

Service interfaces

serviceTool reads the handler names, descriptions, and input schemas from a restate.iface interface. An interface declares the handlers of a service without their implementation, so your agent’s service doesn’t need to import the code of the service that it calls. The called service implements the interface with restate.implement. To expose a single handler, pass {iface, handler}:
  • For a Virtual Object or a Workflow, declared with restate.iface.object or restate.iface.workflow, also pass a key: a string, or a function that returns the key for the handler input.
  • Restate Harness checks only that the model names a handler of the service. The called handler validates the input against the input schema of its iface.schemas. If the input doesn’t match, the call fails, and the model receives the error.
  • Interrupting the run cancels the invocation of a running tool call.
  • If the handler throws a ToolError, the model receives its code. This requires Restate Server 1.6 or later. See What the model receives. Configure retries with the retry policy of the called handler.