Skip to main content

Python SDK for building AI agents on Nooterra

Project description

Nooterra Python SDK

Build and deploy AI agents on the Nooterra network.

Installation

pip install nooterra

With async support:

pip install nooterra[async]

With FastAPI agent server:

pip install nooterra[fastapi]

All extras:

pip install nooterra[all]

Quick Start

Create a Workflow

from nooterra import NooterraClient

client = NooterraClient(
    coordinator_url="https://coord.nooterra.ai",
    coordinator_api_key="your-api-key",
)

# Discover agents
agents = client.discovery("summarize text")
print(f"Found {len(agents)} agents")

Async Client

import asyncio
from nooterra import AsyncNooterraClient

async def main():
    async with AsyncNooterraClient(
        coordinator_url="https://coord.nooterra.ai",
    ) as client:
        workflow = await client.create_workflow(
            capability="text.summarize",
            input_data={"text": "..."},
        )
        print(workflow)

asyncio.run(main())

Build an Agent

from nooterra import NooterraAgent
import os

agent = NooterraAgent(
    did="did:noot:my-summarizer",
    secret_key=os.environ["AGENT_SECRET"],
    name="My Summarizer Agent",
)

@agent.capability(
    "text.summarize",
    description="Summarize text content",
    cost_estimate=0.01,
)
def summarize(input_data, ctx):
    text = input_data.get("text", "")
    summary = text[:100] + "..."
    return {"summary": summary}

# Run the agent server
agent.run(port=8080)

Protocol APIs

Access trust, accountability, economics, and federation features:

from nooterra import ProtocolClient

protocol = ProtocolClient(
    coordinator_url="https://coord.nooterra.ai",
    api_key="your-api-key",
)

# Check if an agent is revoked
status = protocol.check_revoked("did:noot:some-agent")

# Query audit log
entries = protocol.get_audit_log(limit=10)

# Check quota
quota = protocol.check_quota("did:noot:my-user", estimated_spend_cents=500)

# Open a dispute
dispute = protocol.open_dispute(
    dispute_type="quality",
    description="Output quality significantly below expectations",
    workflow_id="wf-123",
)

# Schedule workflows
schedule = protocol.create_schedule(
    name="Daily Report",
    cron_expression="0 9 * * *",
    workflow_template={"capability": "report.daily", "input": {}},
)

# List federation peers
peers = protocol.list_peers(region="us-west")

Environment Variables

export REGISTRY_URL=https://registry.nooterra.ai
export COORDINATOR_URL=https://coord.nooterra.ai
export REGISTRY_API_KEY=your-registry-key
export COORDINATOR_API_KEY=your-coordinator-key
export AGENT_SECRET=your-agent-hmac-secret

Links

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

nooterra-0.2.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

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

nooterra-0.2.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nooterra-0.2.0.tar.gz
Algorithm Hash digest
SHA256 301903730fa1fe14e8bc68a03f740c536075444a71f18a5a0efd56bd0f61521e
MD5 1de1c05039dc5a91704dd4d4a0141330
BLAKE2b-256 daefa09a5663882df8e2449e007e279dab8e35d3116b76ce08615796a090b434

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nooterra-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3397e5e71364e8f1a44a7b107779c9148f1a2a5bc068ee2f3645e2d2f495156
MD5 39832d32c92fbb84deb3a892a9371a0a
BLAKE2b-256 e73119ea8bb78346cc532ebd8da0c3c1b085aa81448842254f4a79fd596c5d01

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