Skip to main content

AstraForge Toolkit

Lightweight Python package for using AstraForge DeepAgent and sandboxes from another project.

Contents:

  • astraforge_toolkit.SandboxBackend: DeepAgents backend that executes via the remote AstraForge sandbox API.
  • astraforge_toolkit.DeepAgentClient: HTTP client for DeepAgent conversations, sandbox sessions (create/list/heartbeat/stop/delete), file upload/download/export, and streaming replies.
  • Remote sandbox tools: sandbox_shell, sandbox_python_repl, sandbox_open_url_with_playwright, sandbox_view_image — all execute inside the sandbox via HTTP.

Install

pip install astraforge-toolkit

Quick start

Create a sandbox-backed DeepAgent

from deepagents import create_deep_agent
from langchain_openai import ChatOpenAI
from astraforge_toolkit import (
    SandboxBackend,
    sandbox_shell,
    sandbox_python_repl,
    sandbox_open_url_with_playwright,
    sandbox_view_image,
)

def backend_factory(rt):
    return SandboxBackend(
        rt,
        base_url="https://your.astra.forge/api",
        api_key="your-api-key",
        # optional: session_params={"image": "astraforge/codex-cli:latest"},
    )

model = ChatOpenAI(model="gpt-4o", api_key="...")
agent = create_deep_agent(model=model, backend=backend_factory)

# Optional: register sandbox tools with your agent/tool registry
tools = [sandbox_shell, sandbox_python_repl, sandbox_open_url_with_playwright, sandbox_view_image]

Create a sandbox session (no DeepAgent conversation)

from astraforge_toolkit import DeepAgentClient

client = DeepAgentClient(base_url="https://your.astra.forge/api", api_key="your-api-key")
sandbox = client.create_sandbox_session(session_params={"image": "astraforge/codex-cli:latest"})

# Upload text (or bytes) into the sandbox workspace
client.upload_file(sandbox.session_id, "/workspace/hello.txt", content="hello from toolkit!\n")

# Download the file back; omit encoding to get raw bytes
print(client.get_file_content(sandbox.session_id, "/workspace/hello.txt", encoding="utf-8"))

# Export a file as an artifact (resolves download URL when configured)
artifact = client.export_file(
    sandbox.session_id,
    "/workspace/hello.txt",
    filename="hello.txt",
    content_type="text/plain",
)
print("artifact id:", artifact.artifact_id, "download:", artifact.download_url)

# Keep the sandbox alive or clean it up when finished
client.heartbeat_sandbox_session(sandbox.session_id)
client.stop_sandbox_session(sandbox.session_id)  # or client.delete_sandbox_session(...)

Call DeepAgent over HTTP

from astraforge_toolkit import DeepAgentClient

client = DeepAgentClient(base_url="https://your.astra.forge/api", api_key="your-api-key")
conv = client.create_conversation()

for chunk in client.stream_message(conv.conversation_id, "Hello, sandbox!"):
    print(chunk)

Build & publish

cd astraforge-python-package
python -m build
python -m twine upload dist/*  # or use --repository testpypi

Configure ~/.pypirc or set TWINE_USERNAME=__token__ and TWINE_PASSWORD=<pypi-token> for uploads.

Examples

See examples/local_api_test.ipynb for a quick notebook that exercises the client against a local http://localhost:8001/api instance.

Metadata

Release files for astraforge-toolkit 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for astraforge-toolkit 0.1.10
File Size Uploaded
astraforge_toolkit-0.1.10.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for astraforge-toolkit 0.1.10
File Interpreter ABI Platform
astraforge_toolkit-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 34.4 kB

Release files / astraforge_toolkit-0.1.10.tar.gz

Download URL astraforge_toolkit-0.1.10.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c14854e9ee45dafbe03e66b3baf2fa3b08c5a0c11d73723468aa2925305ba32a
BLAKE2b-256 checksum
How to use checksums
ac151c767200fe66d691a8dcc6342488974cf017f220db060a5fdd9538ea877d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.10

Release files / astraforge_toolkit-0.1.10-py3-none-any.whl

Download URL astraforge_toolkit-0.1.10-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
868c502588dff97e519161cc94722d2becb5a6a771a48c219a5ebaa2771565a7
BLAKE2b-256 checksum
How to use checksums
9d7f9164fec7601a0ce527af4daa3710194a38ed686669bb6a414ff32f5b3fb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.10

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page