Official Python SDK for BambooSnow AI agent automation platform
Project description
BambooSnow Python SDK
Official Python SDK for the BambooSnow AI agent automation platform.
Installation
pip install bamboosnow
Quick Start
from bamboosnow import BambooSnowClient
# Using environment variable BAMBOOSNOW_API_KEY
client = BambooSnowClient()
# Or pass the API key directly
client = BambooSnowClient(api_key="bs_...")
# List your agents
agents = client.agents.list()
for agent in agents.items:
print(f"{agent.name}: {agent.status}")
# Get a specific run
run = client.runs.get("run_abc123")
print(f"Status: {run.status}, Tokens: {run.tokens_used}")
# Approve a pending action
client.runs.approve("run_abc123", approved=True, comment="Looks good!")
Async Support
The SDK includes full async support:
import asyncio
from bamboosnow import AsyncBambooSnowClient
async def main():
async with AsyncBambooSnowClient() as client:
agents = await client.agents.list()
for agent in agents.items:
print(f"{agent.name}: {agent.status}")
asyncio.run(main())
Resources
Agents
# List agents
agents = client.agents.list(status="deployed")
# Get agent details
agent = client.agents.get("agt_abc123")
# Pause/resume agents
client.agents.pause("agt_abc123")
client.agents.resume("agt_abc123")
# Get agent health
health = client.agents.get_health("agt_abc123")
print(f"Grade: {health.grade}, Score: {health.overall_score}")
# Trigger a manual run
result = client.agents.trigger("agt_abc123", {"pr_number": 42})
print(f"Run ID: {result['run_id']}")
# List templates
templates = client.agents.list_templates()
Runs
# List runs
runs = client.runs.list(agent_id="agt_abc123")
# Get run details with thought trace
run = client.runs.get("run_abc123")
for step in run.thought_trace:
print(f"[{step.type}] {step.content}")
# Approve/reject pending actions
client.runs.approve("run_abc123", approved=True)
client.runs.approve("run_abc123", approved=False, comment="Too risky")
# Cancel a running job
client.runs.cancel("run_abc123", reason="No longer needed")
# Wait for completion
run = client.runs.wait_for_completion(
"run_abc123",
on_progress=lambda r: print(f"Status: {r.status}")
)
# Get runs pending approval
pending = client.runs.get_pending_approvals()
Repositories
# List connected repos
repos = client.repositories.list()
# Connect a repository
repo = client.repositories.connect(
provider="github",
full_name="myorg/myrepo"
)
# Run analysis
analysis = client.repositories.analyze(repo.id)
# Wait for analysis to complete
analysis = client.repositories.wait_for_analysis(
analysis.id,
on_progress=lambda a: print(f"{a.progress_percent}% complete")
)
# Get latest analysis
latest = client.repositories.get_latest_analysis(repo.id)
API Keys
# List keys
keys = client.api_keys.list()
# Create a new key
result = client.api_keys.create(name="CI/CD Key")
print(f"Key: {result['key']}") # Only shown once!
# Revoke a key
client.api_keys.revoke("key_abc123")
Configuration
Environment Variables
BAMBOOSNOW_API_KEY: Your API keyBAMBOOSNOW_BASE_URL: Custom API base URL (for self-hosted)
Client Options
client = BambooSnowClient(
api_key="bs_...",
base_url="https://api.bamboosnow.co", # or self-hosted URL
timeout=60.0, # request timeout in seconds
max_retries=3, # retry attempts for failed requests
)
Error Handling
from bamboosnow import BambooSnowClient
from bamboosnow.errors import (
APIError,
AuthenticationError,
NotFoundError,
RateLimitError,
ValidationError,
)
client = BambooSnowClient()
try:
agent = client.agents.get("agt_abc123")
except AuthenticationError:
print("Invalid API key")
except NotFoundError:
print("Agent not found")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after} seconds")
except ValidationError as e:
print(f"Validation error: {e.errors}")
except APIError as e:
print(f"API error: {e.message}")
Type Hints
The SDK is fully typed. All models are Pydantic v2 models with full IDE support:
from bamboosnow import Agent, AgentStatus
def process_agent(agent: Agent) -> None:
if agent.status == AgentStatus.DEPLOYED:
print(f"{agent.name} is running")
License
MIT
Project details
Release history Release notifications | RSS feed
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 bamboosnow-0.1.0.tar.gz.
File metadata
- Download URL: bamboosnow-0.1.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87157e9a6dbba7d3fd02869f4f845c5a92196c8434591ccbd939b485adef5409
|
|
| MD5 |
7c85e5ab55e22b59dcb9d6ce47c6a5b1
|
|
| BLAKE2b-256 |
154a2f35813117b89aa6219e5a9ae60fc06efcb6df16b959847b7cfdd430e577
|
Provenance
The following attestation bundles were made for bamboosnow-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on HCS412/BambooSnow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bamboosnow-0.1.0.tar.gz -
Subject digest:
87157e9a6dbba7d3fd02869f4f845c5a92196c8434591ccbd939b485adef5409 - Sigstore transparency entry: 833807827
- Sigstore integration time:
-
Permalink:
HCS412/BambooSnow@33fc879b958525ebf9bf32f8485e69c290dbedff -
Branch / Tag:
refs/tags/python-sdk-v0.1.0 - Owner: https://github.com/HCS412
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@33fc879b958525ebf9bf32f8485e69c290dbedff -
Trigger Event:
push
-
Statement type:
File details
Details for the file bamboosnow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bamboosnow-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cee1b44b722239b9b8df99e44e0dce13abd9dbeae0ed8930e98c397da3d0cb9
|
|
| MD5 |
091150eeb1d5e889a66e94e45f18898d
|
|
| BLAKE2b-256 |
35333bcc1ba310a87544d9cc17f5c40fdc21be9eb2f062b9f2949750b22732cc
|
Provenance
The following attestation bundles were made for bamboosnow-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on HCS412/BambooSnow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bamboosnow-0.1.0-py3-none-any.whl -
Subject digest:
1cee1b44b722239b9b8df99e44e0dce13abd9dbeae0ed8930e98c397da3d0cb9 - Sigstore transparency entry: 833807829
- Sigstore integration time:
-
Permalink:
HCS412/BambooSnow@33fc879b958525ebf9bf32f8485e69c290dbedff -
Branch / Tag:
refs/tags/python-sdk-v0.1.0 - Owner: https://github.com/HCS412
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@33fc879b958525ebf9bf32f8485e69c290dbedff -
Trigger Event:
push
-
Statement type: