Skip to content
Ensoul

SDKs

Official client libraries for 7 languages. All SDKs provide a consistent interface for authentication, streaming, pagination, and error handling.

ℹ

Get the packages

Python on PyPI · TypeScript on npm · All 7 SDKs on GitHub.

Supported Languages

Installation

pip install ensoul
⚠

Python requires 3.11 or newer

The Python SDK requires Python 3.11+. On Python 3.9 or 3.10, pip install ensoul fails with no compatible version. Check your version with python --version and upgrade if needed.

Quick Example

All SDKs follow the same pattern: create a client, call resources.

Health Check

from ensoul import Ensoul

client = Ensoul()  # reads ENSOUL_API_KEY from env
health = client.health.check()
print(f"API status: {health}")

Hello World

Create a persona with no world, send it one message as one of your end users, and end the conversation.

# pip install ensoul
from ensoul import Ensoul

client = Ensoul(api_key="YOUR_API_KEY")

# A persona needs no world. This one stands alone.
persona = client.personas.create(name="Ada")

# user_id is your own id for the person talking.
# Each end user gets their own conversations with the persona.
reply = client.chat.send(
    persona.id,
    "Hi! Who are you?",
    user_id="YOUR_END_USER_ID",
)
print(reply.response)

# End the conversation when the person is done.
client.chat.end_conversation(
    persona.id,
    reply.conversation_id,
    user_id="YOUR_END_USER_ID",
)

Features

End Users

Talk to a persona on behalf of your own end users. Each gets their own conversations. End a conversation when the person is done, and forget an end user with a team key.

Auto-Pagination

Iterate through large result sets automatically. All list endpoints return paginated results that the SDK handles for you.

Streaming Support

Real-time streaming for chat, asking a world, and simulations via Server-Sent Events.

Automatic Retries

Transient failures are retried with exponential backoff and jitter. Rate-limit headers are respected automatically.

Dual Authentication

Authenticate with API keys for server-to-server use, or OAuth tokens for user-facing applications.

Environment Variables

All SDKs read these environment variables as defaults when no explicit value is passed to the client constructor.

VariablePurposeDefault
ENSOUL_API_KEYAPI key for authentication(none)
ENSOUL_BASE_URLAPI base URLhttps://api.ensoul-ai.com

Next Steps