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"]})
Admin Token Auth
For local development or operator-controlled scripts, use an actor label and an AgentBox admin token:
from agentbox import AgentBoxClient
client = AgentBoxClient(
base_url="http://127.0.0.1:3000",
actor="research-agent",
token="dev-token",
)
Auth Modes
AgentBox supports admin/grant-token compatibility auth with actor + token,
and OIDC auth with identity_token. 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()
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file niuniu_agentbox-0.1.1.tar.gz.
File metadata
- Download URL: niuniu_agentbox-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e2e8060eb3d2401a7bf7801eeae3de20c7977cff5899372d97ea95b12c72810
|
|
| MD5 |
68dd141a16d6710bb1bb08eef3b13c4f
|
|
| BLAKE2b-256 |
39bb5024c4982b648269417a0f57e345fbfa07fb4671bb8bd3d60afe02b068bf
|
Provenance
The following attestation bundles were made for niuniu_agentbox-0.1.1.tar.gz:
Publisher:
publish-sdk.yml on pengmu/agent-box
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
niuniu_agentbox-0.1.1.tar.gz -
Subject digest:
0e2e8060eb3d2401a7bf7801eeae3de20c7977cff5899372d97ea95b12c72810 - Sigstore transparency entry: 1630851828
- Sigstore integration time:
-
Permalink:
pengmu/agent-box@ff06927779ba79f9cf470c46f9389d7ea03f5e5c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pengmu
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@ff06927779ba79f9cf470c46f9389d7ea03f5e5c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file niuniu_agentbox-0.1.1-py3-none-any.whl.
File metadata
- Download URL: niuniu_agentbox-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a85f7bea04317c2e328b5f351aa9f63834ed851a34cdaed1d1386f92030977f
|
|
| MD5 |
7f234e623ba1c6e5c99366049cf1dce9
|
|
| BLAKE2b-256 |
0c035bb9c0c22e36cd756a7718527b4d5e03ed7b8540fdd451bc9eb2ef4c7e7e
|
Provenance
The following attestation bundles were made for niuniu_agentbox-0.1.1-py3-none-any.whl:
Publisher:
publish-sdk.yml on pengmu/agent-box
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
niuniu_agentbox-0.1.1-py3-none-any.whl -
Subject digest:
0a85f7bea04317c2e328b5f351aa9f63834ed851a34cdaed1d1386f92030977f - Sigstore transparency entry: 1630851840
- Sigstore integration time:
-
Permalink:
pengmu/agent-box@ff06927779ba79f9cf470c46f9389d7ea03f5e5c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pengmu
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@ff06927779ba79f9cf470c46f9389d7ea03f5e5c -
Trigger Event:
workflow_dispatch
-
Statement type: