Skip to main content

Python SDK for Nevo — the inbound event gateway.

Project description

Nevo Python Library

PyPI version Python versions License

The official Python library for Nevo — one inbound layer for your backend. Webhooks, emails, and more land on a single handler, signature-verified and ready to process. Works the same whether the handler is a traditional service or an AI agent reading the world and replying.

Documentation

See the Python quickstart and events reference.

Requirements

  • Python 3.10+

Installation

pip install nevo-sdk

The import path stays nevo — only the distribution name carries the -sdk suffix:

from nevo import Nevo

Usage

You need an API key from the Nevo dashboard (starts with nvo_live_).

import asyncio, os
from nevo import Nevo

async def main():
    async with Nevo(token=os.environ["NEVO_API_KEY"]) as client:

        @client.on_event()
        async def handle(event):
            if event.type == "email.received":
                await event.reply(text="Got it — on it.")
            elif event.type == "webhook.received":
                print(event.webhook.method, event.webhook.path)

        await client.run()

asyncio.run(main())

For scripts that don't want to manage the event loop:

client.run_sync()

Events

Every event exposes the following fields:

Field Type
id str Stable across replays
type str webhook.received or email.received
origin str live or replay
created_at datetime Server-side ingest time
channel Channel The channel that received the event
data dict The raw source payload
webhook WebhookData | None Set when type == "webhook.received"
email EmailData | None Set when type == "email.received"
prompt_ready str Text rendering of the event (useful when the next hop is a model)

Branch on event.type:

@client.on_event()
async def handle(event):
    if event.type == "email.received":
        print(event.email.from_, event.email.subject)
    elif event.type == "webhook.received":
        print(event.webhook.method, event.webhook.path)

Replies

Respond on the same channel the event arrived on. Email replies are threaded into the original conversation automatically.

await event.reply(
    text="Thanks for your message.",
    subject="Re: API limits",      # email-only; defaults to "Re: <original>"
    cc=["ops@acme.com"],            # email-only
)

Channels that don't accept replies (webhook, cron) raise UnsupportedChannelError client-side — no round-trip.

Configuration

client = Nevo(
    token="nvo_live_...",
    handler_timeout=30.0,
    reconnect_max_backoff=30.0,
    http_timeout=10.0,
    http_max_retries=3,
    logger=None,
)
Option Default Description
token API key from the Nevo dashboard
handler_timeout 30.0 Seconds before a handler is considered stuck
reconnect_max_backoff 30.0 Cap on exponential reconnect delay
http_timeout 10.0 Per-request timeout for HTTP calls
http_max_retries 3 Retries for transient HTTP failures
logger logging.getLogger("nevo") Your own logging.Logger

Handler behavior

Handlers must be declared with async def. One handler per client — branch on event.type inside it.

  • Returning cleanly means the event was handled.
  • Raising logs the exception and continues the stream.
  • Exceeding handler_timeout is logged as a timeout and the stream continues.

Events are not re-delivered to the SDK on handler failure. Replay them from the dashboard when you need to.

Reconnects

The client reconnects automatically with exponential jittered backoff, capped at reconnect_max_backoff. A 401 from the server raises AuthError and does not retry — fix the key and reconnect.

Logging

The SDK logs under the nevo logger:

import logging
logging.getLogger("nevo").setLevel(logging.DEBUG)

Errors

All exceptions inherit from nevo.NevoError. Catch broadly, act specifically.

Exception Raised when Retryable
AuthError API key rejected by the server No
ConnectionError WebSocket cannot connect after retries No
HandlerTimeoutError Handler exceeded handler_timeout No
ReplyError Base class for reply failures
UnsupportedChannelError Channel type doesn't accept replies No
RequestError Client-side validation or server 4xx No
ServerError Server 5xx after retries Yes
NetworkError Network failure after retries Yes
from nevo import Nevo, AuthError, ReplyError

try:
    asyncio.run(client.run())
except AuthError:
    # Fix the key and restart.
    ...

try:
    await event.reply(text="…")
except ReplyError as exc:
    if exc.is_transient:
        # Enqueue for later retry.
        ...

Support

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

nevo_sdk-0.1.3.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

nevo_sdk-0.1.3-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file nevo_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: nevo_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for nevo_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5dfd8c424c118169867828a15e2292b358b932663852ddb50fa1e0a1662a3845
MD5 2b1cc44fd797679bde5973cbdcaed4b3
BLAKE2b-256 f1a8a0bc75c70d4191adebedc77a160801a65f5d2871471acf1641034be37f4f

See more details on using hashes here.

File details

Details for the file nevo_sdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nevo_sdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for nevo_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f6b17946934206017e896e203d09c7f9f625ce7033281f19b876a56b2bd424fc
MD5 82ce9d4e39ff009a497519041a72d505
BLAKE2b-256 13e92d3445b60fd3bf49a024610b3cf8e417d0e3398a788a914bf4fabf892033

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