Skip to main content

Python SDK for Neonloops — run AI workflows via API

Project description

neonloops

Python SDK for Neonloops — run AI workflows via API.

Installation

pip install neonloops

Quick Start

Async (recommended)

import asyncio
from neonloops import Runner, RunInput

runner = Runner(
    api_key="nl_sk_...",
    # base_url="https://neonloops.com",  # optional, defaults to https://neonloops.com
)

async def main():
    result = await runner.run(
        workflow_id="wf_abc123",
        input=[RunInput(role="user", content="Hello, run my workflow!")],
    )
    print(result.output)
    print(result.metadata.tokens)

asyncio.run(main())

Sync

from neonloops import Runner, RunInput

runner = Runner(
    api_key="nl_sk_...",
    # base_url="https://neonloops.com",  # optional, defaults to https://neonloops.com
)

result = runner.run_sync(
    workflow_id="wf_abc123",
    input=[RunInput(role="user", content="Hello!")],
)
print(result.output)

Configuration

Parameter Type Default Description
api_key str Required. Your Neonloops API key (nl_sk_...)
base_url str https://neonloops.com Base URL of your Neonloops instance
project_id str None Default project ID to scope requests
timeout float 120.0 Request timeout in seconds
max_retries int 2 Max retries for 429/5xx errors

Error Handling

from neonloops import Runner, NeonloopsApiError, NeonloopsTimeoutError

try:
    result = await runner.run(
        workflow_id="wf_abc123",
        input=[RunInput(role="user", content="Hello")],
    )
except NeonloopsApiError as e:
    print(f"API error {e.status}: {e}")
except NeonloopsTimeoutError as e:
    print(f"Timeout: {e}")

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

neonloops-0.2.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

neonloops-0.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file neonloops-0.2.0.tar.gz.

File metadata

  • Download URL: neonloops-0.2.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for neonloops-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f9e6fb94b32c295f241e2a0cec67c24d14c304ea119c49c4de028fbebc84a2dc
MD5 f0e76b7529a75bf6e1a0ef44522779b0
BLAKE2b-256 d406160b326c1c63528949404132fdefe52d889008b13fe49863607ab749a335

See more details on using hashes here.

File details

Details for the file neonloops-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: neonloops-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for neonloops-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9df9ce7b10b9595783e77c7c90e036c40abfe87b19f236884e1c5de9a571102
MD5 86c87ab3e9e7c5b84838a80cb62c1d45
BLAKE2b-256 b9c9a2c0525ea555a0a409a14649b224cbf927d8ddc443934e167a95d7d8ca45

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