Skip to main content

Python SDK for AINative Agent APIs - agents, swarm, memory, graph, vectors, chat, files, tables, threads, events

Project description

ainative-agent

Python SDK for all AINative Agent APIs -- agents, swarm tasks, memory, graph, vectors, chat, files, tables, threads, and real-time events.

Install

pip install ainative-agent

Quick Start

import asyncio
from ainative_agent import AINativeClient

async def main():
    async with AINativeClient(api_key="sk-your-key") as client:
        # Register an agent
        agent = await client.agents.register(
            "my-agent", "worker", ["read", "write"]
        )

        # Store a memory
        memory = await client.memory.remember(
            "User prefers dark mode",
            entity_id="user-123",
            importance=0.8,
        )

        # Recall memories
        results = await client.memory.recall("user preferences", entity_id="user-123")

        # Submit a swarm task
        task = await client.tasks.submit(
            "Analyze error logs from last 24h",
            agent_types=["analyst"],
        )

        # Poll until complete
        async for update in client.tasks.poll(task.task_id):
            print(f"Status: {update.status}")

asyncio.run(main())

Modules

Module Description
client.agents Agent registration, keys, and audit (AAP)
client.tasks Swarm task submission and polling
client.memory ZeroMemory: remember, recall, forget, reflect
client.graph Context graph: entities, edges, GraphRAG, ontology
client.vectors Vector embeddings: upsert, search, delete
client.files File storage: upload, download, presigned URLs
client.tables NoSQL tables: create, query, insert, update
client.chat Chat completions with streaming
client.threads Conversation threads
client.events Real-time WebSocket events

Authentication

The SDK supports two authentication methods:

# API Key (recommended for server-side)
client = AINativeClient(api_key="sk-your-key")

# JWT Token (for user-scoped access)
client = AINativeClient(token="eyJ...")

Error Handling

from ainative_agent import AINativeClient, AuthenticationError, RateLimitError, APIError

async with AINativeClient(api_key="sk-key") as client:
    try:
        agent = await client.agents.get("nonexistent")
    except AuthenticationError:
        print("Invalid credentials")
    except RateLimitError as e:
        print(f"Rate limited, retry after {e.retry_after}s")
    except APIError as e:
        print(f"API error {e.status_code}: {e.message}")

Retry Behavior

The SDK automatically retries requests on transient errors (429, 5xx) with exponential backoff, up to 3 attempts.

License

Apache-2.0

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

ainative_agent-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

ainative_agent-0.1.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file ainative_agent-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for ainative_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f885233ce34ad1bfe81f101f7b0f2051834f664451229d421e8891147cf24a5a
MD5 6135b106d2a23256be97fc9c38e2f7a1
BLAKE2b-256 07146198dcefa9c77975281d0737e82e096ac6bc43a3d35d904042372fe68d04

See more details on using hashes here.

File details

Details for the file ainative_agent-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for ainative_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0c63fc69453265f8f42d7f16c2a369f3a33328f54008e64d976ea5b5207c003
MD5 1c3af582934d941ddbe526162ee2cc29
BLAKE2b-256 7d99f7ec292dacda079c41ebb17f1acfd26368db701f086f1538afaf8a527f8b

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