대시보드
SDK

Python SDK

Python용 메모리 및 x402 도우미.

Python SDK는 Python 명명 규칙에서 동일한 명시적 메모리 및 x402 경계를 노출합니다.

#설치

pip install halo-sdk

#인증 및 OAuth

from halo import create_client, HaloOAuthClient

# OEM or application user Authentication.
halo = create_client(
    "https://api.agihalo.com",
    HALO_PROJECT_PUBLISHABLE_KEY,
)
session = halo.auth.sign_in_with_password({
    "email": "user@example.com",
    "password": "Secret123!",
})
user = halo.auth.get_user()

# 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. Project sessions stay in memory by default and may use one explicit storage adapter; Service OAuth tokens remain caller-managed.

#메모리 클라이언트

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.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",
)

#연결된 계정

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

#레거시 라우터 헤더

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.

새로운 통합에서는 함수 선언과 직접 함수를 선호해야 합니다 실행. 라우터 검색에서는 HALO에게 프록시 모델 요청에 압축 컨텍스트 및 함수 선언을 삽입하도록 요청합니다.

#결제 도우미

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)