ChatATP Studio SDK
Python SDK for building and interacting with agents created in ChatATP Studio.
- Async-first API
- Conversation lifecycle management
- Streaming support
- Fully typed
chatatp-studio
Official Python SDK for the ChatATP Studio Developer API.
Requirements
- Python 3.10+
Installation
pip install chatatp-studio
Quick start
import asyncio
from chatatp_studio import ChatATPClient
async def main():
client = ChatATPClient(api_key="chatatp_sk_...")
# Send a message — conversation lifecycle handled automatically
result = await client.chat(
agent_id=7,
external_user_id="user_12345",
message="Do you ship to Lagos?",
)
print(result.agent_message.content)
# → "Yes, shipping is available."
await client.aclose()
asyncio.run(main())
Context manager
async with ChatATPClient(api_key="chatatp_sk_...") as client:
result = await client.chat(
agent_id=7,
external_user_id="user_12345",
message="Hello!",
)
Streaming
import sys
async for event in await client.chat_stream(
agent_id=7,
external_user_id="user_12345",
message="Give me a summary of your return policy.",
):
if event.type == "agent.response.delta":
sys.stdout.write(event.data.get("delta", ""))
sys.stdout.flush()
elif event.type == "tool.execution.started":
print(f"\n[Running tool: {event.data.get('name')}]")
elif event.type == "tool.execution.completed":
print(f"\n[Tool completed. Result: {event.data.get('result')}]")
elif event.type == "error":
print(f"\n[Error: {event.data.get('message')}]")
elif event.type == "agent.response.completed":
print("\nFinished!")
Resources
# Agents
page = await client.agents.list()
agent = await client.agents.retrieve(7)
# Conversations
conv = await client.conversations.create(7, "user_12345")
page = await client.conversations.list(agent_id=7)
await client.conversations.delete(conv.id)
# Messages
history = await client.messages.list(conv.id)
reply = await client.messages.send(conv.id, "Hello")
# Usage
usage = await client.usage.retrieve()
Error handling
from chatatp_studio import NotFoundError, RateLimitError
try:
await client.agents.retrieve(999)
except NotFoundError:
print("Not found")
except RateLimitError:
print("Rate limited")
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chatatp_studio-0.1.1.tar.gz
(11.8 kB
view details)
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 chatatp_studio-0.1.1.tar.gz.
File metadata
- Download URL: chatatp_studio-0.1.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d1b9dc9d2263b12dfeca68fc974491b55c0961f0fae02c01a8113ffabbef25c
|
|
| MD5 |
9d0355b171eda260d2922d032049fa77
|
|
| BLAKE2b-256 |
fca2aa71b91d20a36e44685943aecfb6facea34eb84d6c6c43898011f5f05d52
|
File details
Details for the file chatatp_studio-0.1.1-py3-none-any.whl.
File metadata
- Download URL: chatatp_studio-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
515e224c915f49997bcacdc98f84d12a631f5380a92f1bf0548963ddb26d5140
|
|
| MD5 |
0bb74945e813b1d4ac26d07153f33cc4
|
|
| BLAKE2b-256 |
c44ab289f67a73f8c4fd8091f8916263245f1ee6391e4398dd22d7642202f2d8
|