Python client for the Agent Service workflow execution HTTP API
Project description
Agent Service API — Python client
A Python client library for the Agent Service HTTP API (workflow execution, agents, and related endpoints).
Imports: The implementation package is agentsapi. The PyPI distribution name is agentserviceapi; after pip install agentserviceapi you can import either agentsapi or the thin alias module agentserviceapi (same public symbols). In this monorepo, prefer from agentsapi import ....
Installation
pip install agentserviceapi
For a checkout of this repository, install in editable mode:
pip install -e .
Requires Python 3.10 or newer.
Cursor and Claude Code skills
Bundled markdown skills live next to the package:
agenthub-python-cursor-skill.md— save as.cursor/skills/agenthub-python/SKILL.mdagenthub-python-claude-skill.md— save as.claude/skills/agenthub-python.md(or another name under.claude/skills/)
Print the install directory:
python -c "import pathlib, agentsapi; print(pathlib.Path(agentsapi.__file__).resolve().parent / 'skills')"
On Agent Hub, the same files are also served at /skills/… on your app origin for curl (see the in-product setup guide).
Usage
Basic usage
import asyncio
from agentserviceapi import AgentServiceAPIClient
async def main():
client = AgentServiceAPIClient()
response = await client.execute_agent(
agent_id="your-agent-id",
string_inputs={"1": "Hello, world!"},
environment="playground",
)
print(f"Task ID: {response.task_id}")
print(f"Status: {response.status}")
asyncio.run(main())
Advanced usage
import asyncio
from agentserviceapi import (
AgentServiceAPIClient,
AgentInputs,
AgentServiceAPIException,
AgentServiceAPITimeoutError,
AgentServiceAPIConnectionError,
)
async def main():
client = AgentServiceAPIClient(timeout=60.0) # default base_url is https://sudoiq.com
inputs = AgentInputs(
strings={"1": "Hello", "2": "World"},
images={"1": "base64_image_data"},
)
try:
response = await client.execute_agent(
agent_id="your-agent-id",
string_inputs=inputs.strings,
image_inputs=inputs.images,
environment="production",
)
print(f"Task started: {response.task_id}")
except AgentServiceAPIException as e:
print(f"API Error: {e}")
except AgentServiceAPITimeoutError as e:
print(f"Timeout: {e}")
except AgentServiceAPIConnectionError as e:
print(f"Connection Error: {e}")
asyncio.run(main())
The agentsapi module name is also available for the same symbols (for example from agentsapi import AgentServiceAPIClient).
API reference
AgentServiceAPIClient
Main client for the Agent Service API.
Exceptions
AgentServiceAPIException: General API errorsAgentServiceAPITimeoutError: Request timeout errorsAgentServiceAPIConnectionError: Connection errorsAgentServiceAPIHTTPError: HTTP errors (structureddetail/error_codewhen present)
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentserviceapi-0.1.0.tar.gz.
File metadata
- Download URL: agentserviceapi-0.1.0.tar.gz
- Upload date:
- Size: 69.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54012f52d6242d72fa865db04c44542f15f94ec6049e78cdded81d5ded509950
|
|
| MD5 |
2f142d8cf2333e8b59b3b5fbd05f79cd
|
|
| BLAKE2b-256 |
ea46e1a7d420b0eaac2c98d0a304b0ca269307e0c029285cd18e1d1df55d34ce
|
File details
Details for the file agentserviceapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentserviceapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 80.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e2512952959c3ef28438d60081ea1446a9e3d4ab681db469b4e8cb75a2c5f89
|
|
| MD5 |
a370f82923e58672092d1455595010ad
|
|
| BLAKE2b-256 |
84158fdba09096154bdd43643a74e1acac84d6d71bf603b1764755990f68fcf3
|