Skip to main content

Official Python SDK for ChatATP Studio Developer API

Project description

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

PyPI Python

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

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.completed":
        print(event.data)

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

Project details


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.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatatp_studio-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file chatatp_studio-0.1.0.tar.gz.

File metadata

  • Download URL: chatatp_studio-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for chatatp_studio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 297994913973d7b874e6ecf7149b82e0eb8660ad23cf80d1e321f3c98dd8b891
MD5 f727f04bd99a81100e592b220776d1c8
BLAKE2b-256 0d867e714bafee517277f8532412958c2e819db1715f4ff39c41a854deef35d4

See more details on using hashes here.

File details

Details for the file chatatp_studio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chatatp_studio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for chatatp_studio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7c81424018979f010b4d198a8f914ff642069be3aec7b6feba6bce86b4f6b80
MD5 e417ad5a7ed7efc356caadfc8ad90400
BLAKE2b-256 bdf6c6565dc06b8e96af5f57c98e7e0ad51ca156ed34f6aab89dc5b5c58681df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page