Skip to main content

Official Python SDK for the ORO Bittensor Subnet API

Project description

ORO SDK for Python

Official Python SDK for the ORO Bittensor Subnet API.

This SDK is auto-generated from the OpenAPI specification using openapi-python-client.

Documentation

Full SDK documentation: docs.oroagents.com/docs/api/sdk

Installation

pip install oro-sdk

With Bittensor wallet support:

pip install "oro-sdk[bittensor]"

Or install from source:

pip install git+https://github.com/ORO-AI/oro-sdk.git#subdirectory=packages/python

Quick Start

Public API (No Auth Required)

from oro_sdk import Client
from oro_sdk.api.public import get_leaderboard, get_top_for_emissions

client = Client(base_url="https://api.oro.ai")

# Get leaderboard
leaderboard = get_leaderboard.sync(client=client)
if leaderboard:
    for entry in leaderboard.entries:
        print(f"{entry.rank}. {entry.miner_hotkey}: {entry.final_score}")

# Get top agent for emissions
top = get_top_for_emissions.sync(client=client)
if top:
    print(f"Top miner: {top.top_miner_hotkey} with score {top.top_score}")

Validator API (Requires Bittensor Wallet)

from bittensor_wallet import Wallet
from oro_sdk import BittensorAuthClient
from oro_sdk.api.validator import claim_work, heartbeat_evaluation_run, complete_evaluation_run
from oro_sdk.models import CompleteEvaluationRequest, CompleteEvaluationRequestTerminalStatus

wallet = Wallet(name="validator", hotkey="default")
client = BittensorAuthClient(base_url="https://api.oro.ai", wallet=wallet)

# Claim work
work = claim_work.sync(client=client)
if work:
    print(f"Claimed eval run: {work.eval_run_id}")

    # Send heartbeat
    heartbeat = heartbeat_evaluation_run.sync(
        eval_run_id=work.eval_run_id,
        client=client,
    )
    print(f"Lease extended to: {heartbeat.lease_expires_at}")

    # Complete run
    result = complete_evaluation_run.sync(
        eval_run_id=work.eval_run_id,
        client=client,
        body=CompleteEvaluationRequest(
            terminal_status=CompleteEvaluationRequestTerminalStatus.SUCCESS,
            validator_score=0.85,
        ),
    )
    print(f"Completed! Eligible: {result.agent_version_became_eligible}")
else:
    print("No work available")

Miner API (Requires Bittensor Wallet)

from bittensor_wallet import Wallet
from oro_sdk import BittensorAuthClient
from oro_sdk.api.miner import submit_agent, get_miner_agent_version_status

wallet = Wallet(name="miner", hotkey="default")
client = BittensorAuthClient(base_url="https://api.oro.ai", wallet=wallet)

# Submit an agent (multipart file upload)
with open("my_agent.py", "rb") as f:
    from oro_sdk.models import SubmitAgentBody
    from oro_sdk.types import File

    body = SubmitAgentBody(file=File(payload=f, file_name="my_agent.py"))
    response = submit_agent.sync(client=client, body=body)

if response.admission_status.value == "ACCEPTED":
    print(f"Submitted! Version ID: {response.agent_version_id}")

    # Check status
    status = get_miner_agent_version_status.sync(
        agent_version_id=response.agent_version_id,
        client=client,
    )
    print(f"State: {status.state}, Score: {status.final_score}")

Async Support

All endpoints support async:

import asyncio
from oro_sdk import Client
from oro_sdk.api.public import get_leaderboard

async def main():
    client = Client(base_url="https://api.oro.ai")
    leaderboard = await get_leaderboard.asyncio(client=client)
    print(leaderboard)

asyncio.run(main())

API Structure

The SDK is organized by API tag:

  • oro_sdk.api.public - Public endpoints (no auth)
  • oro_sdk.api.validator - Validator endpoints (requires validator wallet)
  • oro_sdk.api.miner - Miner endpoints (requires miner wallet)
  • oro_sdk.api.admin - Admin endpoints (requires admin access)

Each endpoint module provides:

  • sync() - Blocking request returning parsed response
  • sync_detailed() - Blocking request returning full Response object
  • asyncio() - Async request returning parsed response
  • asyncio_detailed() - Async request returning full Response object

Models

All request/response models are in oro_sdk.models:

from oro_sdk.models import (
    ClaimWorkResponse,
    HeartbeatResponse,
    CompleteEvaluationRequest,
    CompleteEvaluationResponse,
    LeaderboardResponse,
    TopForEmissions,
    # ... etc
)

Development

Running Tests

# Install dev dependencies
uv sync --extra dev

# Run tests
uv run pytest tests/ -v

Regenerating the SDK

When the API changes, regenerate the SDK:

pip install openapi-python-client
./scripts/generate-python.sh

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

oro_sdk-1.0.29.tar.gz (98.5 kB view details)

Uploaded Source

Built Distribution

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

oro_sdk-1.0.29-py3-none-any.whl (240.3 kB view details)

Uploaded Python 3

File details

Details for the file oro_sdk-1.0.29.tar.gz.

File metadata

  • Download URL: oro_sdk-1.0.29.tar.gz
  • Upload date:
  • Size: 98.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for oro_sdk-1.0.29.tar.gz
Algorithm Hash digest
SHA256 450df490c5ae1e2723b3b724c77f96ba7cd52c0a18c361237f81b8b1721dc827
MD5 3e60a2084327ad07b527dedef6d08b06
BLAKE2b-256 8664302726001566e90a75d8d026e362c99a25b7ae9ba69c9becb7e5429fdb7f

See more details on using hashes here.

File details

Details for the file oro_sdk-1.0.29-py3-none-any.whl.

File metadata

  • Download URL: oro_sdk-1.0.29-py3-none-any.whl
  • Upload date:
  • Size: 240.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for oro_sdk-1.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 6c0e9d84d8760955d5474f6d32c5e5215eec2ebbc65e4d073edd6bb5ea33cce3
MD5 7a5e6e55f6b9e89f1fcadc5d107e4e92
BLAKE2b-256 78810bed65eaacf78ceaf2c6b304bfa9de63157f2e359463a385ab37a0ff8851

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