Skip to main content

Asteroid AI

Asteroid Python SDK ☄️

A Python SDK for interacting with the Asteroid platform. To successfully use Asteroid Python SDK, you need to have a running instance of the Asteroid server. Book a demo with Asteroid founders to get started!

Installation

pip install asteroid-sdk

Quick Start

from asteroid_sdk.wrappers.openai import asteroid_openai_client
from asteroid_sdk.registration.initialise_project import asteroid_init
from asteroid_sdk.supervision.decorators import supervise
from asteroid_sdk.supervision.base_supervisors import llm_supervisor, human_supervisor
from openai import OpenAI

# Define your tools with supervisors
@supervise(supervision_functions=[
    [llm_supervisor(instructions="For flights above $1000, escalate."), human_supervisor()]])
def book_flight(departure_city: str, arrival_city: str, datetime: str):
    """Book a flight ticket."""
    return f"Flight booked from {departure_city} to {arrival_city} on {datetime}."

tools = [{
    "type": "function",
    "function": {
        "name": "book_flight",
        "description": "Book a flight ticket.",
        "parameters": {
            "type": "object",
            "properties": {
                "departure_city": {
                    "type": "string"
                },
                "arrival_city": {
                    "type": "string"
                },
                "datetime": {
                    "type": "string"
                }
            },
            "required": [
                "departure_city",
                "arrival_city",
                "datetime"
            ],
            "additionalProperties": False
        },
        "strict": True
    }
}]

# Initialize the SDK
run_id = asteroid_init()

# Wrap your LLM client
client = OpenAI()
wrapped_client = asteroid_openai_client(client, run_id)

# Run your LLM
response = wrapped_client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Book a flight from SF to LA for tomorrow for $1100."}],
    tools=tools
)
# The response is supervised by Asteroid, check the web UI for the results and human review

Documentation

For more information, please refer to the Asteroid Documentation!

Metadata

Release files for asteroid-sdk 0.1.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asteroid-sdk 0.1.29
File Size Uploaded
asteroid_sdk-0.1.29.tar.gz 90.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asteroid-sdk 0.1.29
File Interpreter ABI Platform
asteroid_sdk-0.1.29-py3-none-any.whl Python 3 none any Details

Total release size: 285.4 kB

Release files / asteroid_sdk-0.1.29.tar.gz

Download URL asteroid_sdk-0.1.29.tar.gz
Size 90.0 kB
Tags Source
SHA-256 checksum
How to use checksums
143820215f11e85113c40c3a1822f6048a99978fa0433dd6a2e288f0ae1b9080
BLAKE2b-256 checksum
How to use checksums
2635fd81092ebd55bf4b4fe88a80090390a815b2e072bd0b575ac32d4e035a00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / asteroid_sdk-0.1.29-py3-none-any.whl

Download URL asteroid_sdk-0.1.29-py3-none-any.whl
Size 195.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f1919f3836ef367b17f1d6ebdb6ddd56e2a4086a7333bb4a9e468efac7117e2
BLAKE2b-256 checksum
How to use checksums
0e1f54200218b9b859566e9b3697a073cef90a13b3adff49f3b495c28be638a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.29 This release

2 release files

0.1.28

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page