Dashboard
SDKs

Python SDK

Memory and x402 helpers for Python.

The Python SDK exposes the same explicit Memory and x402 boundaries in Python naming conventions.

#Install

pip install halo-sdk

#Authentication & OAuth

from halo import HaloAuthClient, HaloOAuthClient

# OEM or application user Authentication.
auth = HaloAuthClient(
    publishable_key=HALO_PROJECT_PUBLISHABLE_KEY,
)
session = auth.sign_in_with_password(
    "user@example.com",
    "Secret123!",
)
refreshed = auth.refresh_session(session["refresh_token"])
user = auth.get_user(refreshed["access_token"])

# Service-side OAuth App client.
oauth = HaloOAuthClient(
    client_id="halo_client_...",
    client_secret=HALO_OAUTH_CLIENT_SECRET,
)
tokens = oauth.exchange_code(
    code=callback_code,
    redirect_uri="https://service.example.com/callback",
)

The Python clients expose the same Project-user and Service OAuth boundaries as the Node.js SDK and never persist returned tokens.

#Memory client

from halo import HaloMemoryClient

memory = HaloMemoryClient(
    api_key=HALO_API_KEY,
    project_key="customer-product",
)

declaration = memory.function_declaration()

result = memory.execute_retrieve_function(
    end_user_key="user_123",
    session_data={
        "messages": [
            {"role": "user", "content": "What are my report preferences?"}
        ]
    },
    limit=5,
)

# Feed result["functionResponse"] to your model, then capture the final answer.
memory.capture(
    end_user_key="user_123",
    session_data={
        "messages": [
            {"role": "user", "content": "What are my report preferences?"}
        ]
    },
    response={
        "role": "assistant",
        "content": "You prefer concise reports in the morning.",
    },
)

#Memory deletion

memory.delete_topic(
    end_user_key="user_123",
    topic_key="report_preferences",
    include_raw=False,
)

memory.delete_raw_entry(
    end_user_key="user_123",
    raw_entry_id="raw_entry_id",
)

#Connected accounts

result = memory.start_oauth(
    scope_id="memory-scope-uuid",
    connector_id="google.calendar",
    completion_mode="mobile_deep_link",
    return_uri="example-app://oauth/complete",
)

#Legacy router headers

from halo import halo_memory_headers

headers = halo_memory_headers(
    project_key="customer-product",
    end_user_key="user_123",
    mode="capture",
)

# Pass headers through the provider client's per-request header option.

New integrations should prefer function declaration plus direct function execution. Router retrieval asks HALO to inject compact context and a function declaration into a proxied model request.

#Payment helpers

from halo import HaloPaymentTools

tools = HaloPaymentTools(
    private_key=secure_wallet_private_key,
    api_key=HALO_API_KEY,
    halo_url="https://api.agihalo.com",
)

decision = tools.consult_judge(
    context="Continue an important agent task",
    amount_str="1.00 USDC",
)
signature = tools.sign_payment(payment_requirement)