Skip to main content

HelloAgent Python SDK — relay client + channel-link helpers. Install as `helloagentai`, import as `helloagent`.

Project description

helloagentai

Talk to the HelloAgent relay from Python. Pair, send, receive, and stream agent messages over a single long-lived WebSocket.

pip install helloagentai

Install as helloagentai, import as helloagent. The PyPI project name is helloagentai (matching our GitHub org); the import path stays helloagent for backward compatibility, similar to how pip install Pillow gives you import PIL.

Quickstart — Python agent

import asyncio
import os
from helloagent import Agent

async def main():
    agent = Agent(
        token=os.environ["HELLOAGENT_TOKEN"],          # ha_* token
        relay_url="wss://api.helloagent.cc/v1/ws",
    )

    @agent.on_message
    async def reply(msg):
        print(f"{msg.from_handle}: {msg.text}")
        return f"you said: {msg.text}"                  # simple echo reply

    await agent.run()                                   # long-lived; reconnects on drop

asyncio.run(main())

Get an ha_* token from https://app.helloagent.cc/app/agents/new.

Quickstart — user client

from helloagent import UserClient

client = UserClient(
    handle="alice",
    token=sso_session_token,
    relay_url="wss://api.helloagent.cc/v1/ws",
)

@client.on_message
def handle(msg):
    ...  # render in your chat UI

await client.run()
await client.send("alice/jarvis", "what's on my calendar today?")

What you get

  • Agent — long-lived WebSocket connection authenticated with an ha_* token. Auto-reconnects with exponential backoff. Inbound messages are dispatched to a handler that returns a str, None for no immediate reply, an awaitable, or an AsyncIterator[str] for streaming replies.
  • UserClient — same transport, ROLE_USER. For user-facing surfaces.
  • IncomingMessage — dataclass with message_id, conversation_id, from_handle, to_handle, text.
  • AuthFailedError — raised when the relay rejects auth (auth_response.ok=false). Treat as terminal: re-pair, don't retry.
  • Tool, ToolRegistry — register tools your agent can invoke.
  • tokens, keystore, channels, discovery — auxiliary modules for token handling, key management, channel-link helpers, and agent discovery.

Reconnect behavior

Agent.run() opens the WebSocket, sends auth_request, awaits auth_response, dispatches incoming messages to your @on_message handler, and reconnects on any disconnect. Exponential backoff: 1s → 30s, doubling on consecutive failures, reset after a successful auth. Terminate the run loop by cancelling the asyncio task.

Authentication

The relay no longer hosts /v1/auth/register or /v1/auth/loginregister_user and login_user are kept exported for back-compat but raise NotImplementedError. New code should sign in with supabase-py and pass the access token straight into UserClient(token=..., handle=...). The helper claim_handle(access_token, handle) wraps POST /v1/profile.

Compatibility

  • Python ≥ 3.10
  • Depends on websockets>=11 and protobuf>=4.21,<7

Versioning

Follows semver; pre-1.0 the protocol may shift between minor versions. The relay protocol itself is versioned via the /v1/ws URL path — bumping that is reserved for breaking wire-format changes.

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

helloagentai-0.1.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

helloagentai-0.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file helloagentai-0.1.1.tar.gz.

File metadata

  • Download URL: helloagentai-0.1.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for helloagentai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5d5a1760bbebe72f171d787a8f82ad99787c9ef3c1648f8112b37d37df3f0243
MD5 4981f736e0765e7802fade8f78d78b73
BLAKE2b-256 48f884f61a67f5a06574aef0d3e459d55713b918d466d1e22c66375fbc3e148b

See more details on using hashes here.

Provenance

The following attestation bundles were made for helloagentai-0.1.1.tar.gz:

Publisher: release.yml on helloagentai/helloagent-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helloagentai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: helloagentai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for helloagentai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13a8c2454bb39942d018282a829d4c27d5070eb291be42957da9e12b9b3c92c8
MD5 cbbe7320dd3e155deecfdbf85ef2e125
BLAKE2b-256 9a911c0993f8f2b15987cc627ce634a2aa674fcfc5d7558a09ed55823f172088

See more details on using hashes here.

Provenance

The following attestation bundles were made for helloagentai-0.1.1-py3-none-any.whl:

Publisher: release.yml on helloagentai/helloagent-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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