Skip to main content

Python SDK for AgentBox private agent state and scoped sharing.

Project description

AgentBox Python SDK

niuniu-agentbox is a small Python wrapper around the AgentBox REST API for agent developers and application developers.

from agentbox import AgentBoxClient

client = AgentBoxClient(
    base_url="http://127.0.0.1:3000",
    actor="research-agent",
    token="dev-token",
)

created = client.create_box({"name": "Research agent private store"})
box_id = created["data"]["box"]["box_id"]

client.put_item({
    "box_id": box_id,
    "key": "research/summary",
    "value": "AgentBox stores durable state.",
    "expected_version": 0,
})

The SDK supports the same auth modes as the JavaScript SDK:

  • local/admin or grant compatibility auth: actor + token
  • OIDC auth: identity_token
  • optional grant_token for OIDC callers using an AgentBox grant

With OIDC, the identity proof and AgentBox grant token are sent separately:

writer = AgentBoxClient(
    base_url="https://agent-box.example",
    identity_token="oidc.jwt.token",
    grant_token="abx_grant_token",
)

Use with_auth() to derive a client with different credentials:

grant = client.create_grant({
    "box_id": box_id,
    "subject": "writer-agent",
    "permissions": ["read"],
    "key_prefixes": ["research/"],
    "ttl_seconds": 3600,
})

writer = client.with_auth(
    actor="writer-agent",
    token=grant["data"]["access_token"],
)

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()
list_agents(admin=True)
update_agent_status({"identity_key": ..., "status": "blocked"}, admin=True)
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)
list_audit({"box_id": ...})
with_auth(actor=None, token=None, identity_token=None, grant_token=None, auth_scheme=None)

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

Release Check

python3 -m pip wheel packages/sdk-python --no-deps --wheel-dir /tmp/niuniu-agentbox-python-wheel

Publishing is not enabled until the project owner confirms PyPI namespace, package credentials, and versioning.

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.0.tar.gz (9.2 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.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: niuniu_agentbox-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 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.0.tar.gz
Algorithm Hash digest
SHA256 1595efee1ce8d202c739293258ea49d2235fb12b76e0bf52525c789cf7aa4fe6
MD5 6f35583684bbabc4225674c358922d8d
BLAKE2b-256 88456b512c75752e5d0a98332b98fa090f6269a32780056674ae11a753baca0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for niuniu_agentbox-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for niuniu_agentbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbf6a80d5039e6259b1e53b09cb5c4fd00266de9dbec63884682a2e097256b95
MD5 1173c75ffa465e630bc8fad496c87837
BLAKE2b-256 4d3a090cf57fc0ebe35d5125a1536a54246247a194c8b3757458220bd89d387e

See more details on using hashes here.

Provenance

The following attestation bundles were made for niuniu_agentbox-0.1.0-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