asapi (import from asapi import AsapiClient). A fallback PyPI name may be agentserviceapi — check release notes for pip install lines.
Install
agentservice CLI bundles asapi as well. See CLI.
Authentication
Add a tool
Tools have two parts: a schema on the server (so the model knows the name and arguments) and, for interactive runs, a local async handler in your process. Registering schemas on Sudoiq is not something you repeat on every agent run. Do it once when your application starts (or whenever you deploy a new build that changes tools)—not inside the hot path that callsexecute_agent for each task. After a tool is registered, it stays on the platform until you explicitly delete it. If you change the name, description, or parameters later, register again with the revised schema so Sudoiq stays in sync with what the model and your handler implement.
1. Register the schema
2. Attach a handler and run
Handlers are usuallyasync def with signature (args: dict, agent_id: str, task_id: int) -> str. The client wraps each tool call so it can record errors, traces, and usage metrics alongside normal execution. When the model invokes a tool, args are exactly what the model supplied; agent_id and task_id identify the run that asked for it. That layout lets you register one handler and reuse it across many agents, while still branching on agent_id (or on values in args) when different workflows need different behavior.
Tests and feedback
Store test examples and record run feedback to drive quality and workflow iteration. See Evals, tests, and feedback.Integration patterns
For long-running or fully asynchronous backends, you can start runs and consume updates without holding a single long-lived connection—see Running agents when you need that split.Related
- Getting started
- Webhooks (optional integration style)
- Output validators