Skip to main content

Python SDK for AgentBox private agent state and scoped sharing.

Project description

AgentBox Python SDK

Python SDK for AgentBox private agent state and scoped sharing.

Install

python3 -m pip install niuniu-agentbox

Import the SDK as agentbox:

from agentbox import AgentBoxClient

Discovery And Workflow

import os

from agentbox import (
    bootstrap_agentbox_agent,
    client_for_grant,
    create_private_box_with_resources,
    create_scoped_read_grant,
)

session = bootstrap_agentbox_agent(
    base_url="https://agentbox.niuniu.dev",
    client={
        "identity_token": os.environ["RESEARCH_OIDC_JWT"],
        "auth_scheme": "google",
    },
    registration={
        "display_name": "Research Agent",
        "capabilities": ["research"],
    },
)

workspace = create_private_box_with_resources(session.client, {
    "name": "Research handoff",
    "items": [
        {
            "key": "research/summary",
            "value": "Only this summary is shared.",
            "expected_version": 0,
        },
        {
            "key": "state/internal",
            "value": "Private notes stay hidden.",
            "expected_version": 0,
        },
    ],
})

grant = create_scoped_read_grant(session.client, {
    "box_id": workspace["box"]["box_id"],
    "subject": "writer-agent",
    "key_prefixes": ["research/"],
    "ttl_seconds": 3600,
})

writer = client_for_grant(
    session.client,
    grant,
    identity_token=os.environ["WRITER_OIDC_JWT"],
    auth_scheme="google",
)

manifest = writer.get_manifest({"box_id": workspace["box"]["box_id"]})

Auth Modes

AgentBox clients authenticate with OIDC identity tokens. Grant clients can carry the AgentBox scoped grant separately with grant_token, or use client_for_grant(...) to derive a least-privilege client from a grant response. Pass auth_scheme for named providers such as google.

Methods

health()
discover_agentbox(base_url=... | agent_card_url=...)
bootstrap_agentbox_agent(...)
create_private_box_with_resources(client, data)
create_scoped_read_grant(client, data)
client_for_grant(client, grant, ...)
register_agent(data=None)
get_agent_profile()
create_box(data)
list_boxes()
get_manifest({"box_id": ...})
put_item(data)
get_item(data)
list_items(data)
append_event(data)
list_events(data)
attach_artifact(data)
list_artifacts({"box_id": ...})
get_artifact(data)
create_grant(data)
list_grants({"box_id": ...})
revoke_grant(data)
with_auth(identity_token=None, grant_token=None, auth_scheme=None)

Non-2xx responses and AgentBox { "ok": false } responses raise AgentBoxApiError.

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

niuniu_agentbox-0.1.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

niuniu_agentbox-0.1.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file niuniu_agentbox-0.1.2.tar.gz.

File metadata

  • Download URL: niuniu_agentbox-0.1.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for niuniu_agentbox-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ca5614fc549c9b4cd51aa8ff40c48ce3181b8b387171ffdd12543d7e7ca023d5
MD5 98b6a39bbf6cfb087ffd2cc46adcf78d
BLAKE2b-256 0dc5880dcfbc53bb4f7061bc606df319c0b31a01833e9b84830ae208c1f12312

See more details on using hashes here.

Provenance

The following attestation bundles were made for niuniu_agentbox-0.1.2.tar.gz:

Publisher: publish-sdk.yml on pengmu/agent-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file niuniu_agentbox-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for niuniu_agentbox-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5fb7722532db3335396f7daa96c07b668883988349c6e5d75c0d0d0d78e1c83d
MD5 cb72a728455057c8ceaf898174018515
BLAKE2b-256 7d4bc91f1ed8ab8fd76616f4ef8502ee7490fd5168b559579b47166da151bb4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for niuniu_agentbox-0.1.2-py3-none-any.whl:

Publisher: publish-sdk.yml on pengmu/agent-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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