Skip to main content

arinova-agent-sdk

Python SDK for connecting AI agents to Arinova Chat via WebSocket. Supports streaming responses with automatic reconnection.

Install

pip install arinova-agent-sdk

Requires Python 3.10+.

Quick Start

from arinova_agent import ArinovaAgent

agent = ArinovaAgent(
    server_url="https://chat.arinova.ai",
    bot_token="your-bot-token",
)

@agent.on_task
async def handle(task):
    # Stream chunks to the user
    for word in task.content.split():
        task.send_chunk(word + " ")

    # Signal completion with the full response
    task.send_complete("Echo: " + task.content)

agent.run()

agent.run() blocks the process and handles SIGINT/SIGTERM for graceful shutdown. If you are already inside an async context, use await agent.connect() instead:

import asyncio
from arinova_agent import ArinovaAgent

agent = ArinovaAgent(
    server_url="https://chat.arinova.ai",
    bot_token="your-bot-token",
)

@agent.on_task
async def handle(task):
    task.send_chunk("Thinking...")
    task.send_complete("Done.")

asyncio.run(agent.connect())

API Reference

Constructor

ArinovaAgent(
    server_url: str,           # Arinova Chat server URL
    bot_token: str,            # Bot authentication token
    reconnect_interval: float = 5.0,   # Seconds between reconnect attempts
    ping_interval: float = 30.0,       # Seconds between keepalive pings
)

All parameters are keyword-only.

@agent.on_task

Register a task handler. Called each time the agent receives a message from a user. The handler receives a Task object and can be sync or async.

@agent.on_task
async def handle(task):
    ...

Task Object

Field Type Description
task_id str Unique identifier for this task
conversation_id str Conversation the message belongs to
content str The user's message text
send_chunk Callable[[str], None] Stream a partial response to the user
send_complete Callable[[str], None] Finalize the response with full content
send_error Callable[[str], None] Send an error message back to the user

A typical handler streams chunks as they are generated, then calls send_complete with the assembled full text. If something goes wrong, call send_error instead.

Lifecycle Callbacks

@agent.on_connected
def connected():
    print("Connected")

@agent.on_disconnected
def disconnected():
    print("Disconnected")

@agent.on_error
def error(exc: Exception):
    print("Error:", exc)
  • on_connected -- called after successful authentication.
  • on_disconnected -- called when the WebSocket connection drops.
  • on_error -- called on connection errors or unhandled exceptions in the task handler.

agent.run()

agent.run() -> None

Start the agent in blocking mode. Creates its own event loop, connects to the server, and reconnects automatically on disconnection. Stops on SIGINT or SIGTERM.

await agent.connect()

await agent.connect() -> None

Start the agent within an existing async event loop. Reconnects automatically until disconnect() is called.

await agent.disconnect()

await agent.disconnect() -> None

Close the WebSocket connection and stop automatic reconnection.

Getting a Bot Token

  1. Open the Arinova Chat dashboard.
  2. Navigate to the bot management page and create a new bot.
  3. Copy the bot token from the bot's settings page.
  4. Pass it as the bot_token parameter when creating an ArinovaAgent instance.

License

MIT

Metadata

Release files for arinova-agent-sdk 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arinova-agent-sdk 0.0.1
File Size Uploaded Provenance
arinova_agent_sdk-0.0.1.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for arinova-agent-sdk 0.0.1
File Interpreter ABI Platform
arinova_agent_sdk-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / arinova_agent_sdk-0.0.1.tar.gz

Download URL arinova_agent_sdk-0.0.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
150d05e9f004b9270279cc587904448b1e82ad3325820fc36fed2a1d35965289
BLAKE2b-256 checksum
How to use checksums
5fe9f58273af693e4d8e97e234490c5bd58b7edcbfa5f6f16f7f8a4ab8bb9a34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / arinova_agent_sdk-0.0.1-py3-none-any.whl

Download URL arinova_agent_sdk-0.0.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9db3029f02b0cf06b496bb35e8dac406c10f7b25580e2f29ab81fbfb31fdea2f
BLAKE2b-256 checksum
How to use checksums
f0049c5f923a87075e3abda5e07f6374a424cf0a94e45fee700b610f064be583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for arinova-agent-sdk 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page