Skip to main content

SDK and CLI for building Boxy agents

Project description

boxy-agent

Build Boxy agents as ordinary Python packages.

boxy-agent gives you a clean authoring SDK, a packaging flow, and a local runtime contract for agents that wake on events, read context, call tools, emit follow-up events, and return structured results. The same contract powers Boxy's first-party agents.

Why boxy-agent

  • Start from plain Python instead of a custom DSL
  • Define exactly what data, tools, and events your agent is allowed to use
  • Package agents as installable wheels
  • Run agents through a consistent event-driven contract
  • Keep the authoring surface small enough to learn quickly, but strict enough to ship reliably

Quickstart

Install the CLI with uv:

uv tool install "boxy-agent[packaging]"
boxy-agent --help

If you prefer not to install it globally, use uvx:

uvx --from "boxy-agent[packaging]" boxy-agent --help

Create your first agent:

boxy-agent create-agent automation --project-dir ./email-ops-agent
cd ./email-ops-agent
uv sync

Build a wheel:

uv run boxy-agent package --project-dir . --output-dir ./dist

Install the packaged wheel into the environment where you want to run it, then inspect and execute it:

uv pip install ./dist/*.whl
uv run boxy-agent list-agents --json
uv run boxy-agent run --agent email-ops-agent --event-json '{"type":"start"}'

You can also pass the event as a file:

uv run boxy-agent run --agent email-ops-agent --event-file ./event.json

Event input must decode to a JSON object with:

  • type: required non-empty string
  • description: optional string
  • payload: optional object

boxy-agent run prints a JSON report with the run status, last output, and emitted traces.

What You Build

A Boxy agent project is a normal Python package with Boxy metadata in pyproject.toml.

Minimal layout:

my-agent/
  pyproject.toml
  src/
    my_agent/
      __init__.py
      agent.py

Minimal metadata:

[project]
name = "my-agent"
version = "0.1.0"
description = "My Boxy agent"
requires-python = ">=3.12"
dependencies = ["boxy-agent>=0.2.0a2,<0.3.0"]

[build-system]
requires = ["setuptools>=69.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
package-dir = { "" = "src" }

[tool.setuptools.packages.find]
where = ["src"]

[tool.boxy_agent.agent]
name = "my-agent"
description = "My Boxy agent"
version = "0.1.0"
type = "automation"
module = "my_agent.agent"
expected_event_types = ["start"]

[tool.boxy_agent.capabilities]
data_queries = []
boxy_tools = []
builtin_tools = []
event_emitters = []

Minimal agent:

from boxy_agent import AgentExecutionContext, AgentResult, agent_main


@agent_main
def handle(exec_ctx: AgentExecutionContext) -> AgentResult:
    return AgentResult(
        output={
            "event_type": exec_ctx.event.type,
            "message": "hello from boxy-agent",
        }
    )

Entrypoint rules:

  • your configured module must define exactly one function decorated with @agent_main
  • the entrypoint must be synchronous
  • it must accept exactly one positional execution-context argument
  • that argument must not have a default

Two Agent Styles

boxy-agent supports two agent types:

  • automation: event-driven agents that react to triggers and can declare tool access
  • data_mining: analysis-oriented agents that read data, generate insights, and emit events, but cannot declare boxy_tools

Type-specific rules:

  • automation agents must declare non-empty expected_event_types
  • data_mining agents must not declare expected_event_types
  • data_mining agents must not declare boxy_tools

The CLI scaffold uses data-mining as the command-line name and writes data_mining into project metadata.

Capabilities

Every agent declares the capabilities it needs up front:

  • data_queries: named read/query interfaces exposed by the host runtime
  • boxy_tools: named host actions the agent may invoke
  • builtin_tools: package-provided tools available in the runtime
  • event_emitters: outbound event types the agent may emit

Declared capabilities are validated against the shipped capability catalog during compile and package time. That means an agent fails fast when it asks for a capability that the target runtime does not expose.

SDK Features

The main authoring surface includes:

  • agent_main
  • AgentExecutionContext, AgentEvent, AgentResult, AgentMetadata, AgentCapabilities
  • compile_agent, package_agent
  • query_data, list_data_queries
  • call_boxy_tool, list_boxy_tools
  • call_builtin_tool, list_builtin_tools
  • emit_event
  • memory_get, memory_set, memory_delete
  • trace
  • terminate
  • llm_chat_complete

Typical usage patterns:

  • use query_data to pull context from Boxy-connected sources
  • use call_boxy_tool to request side effects through the host runtime
  • use call_builtin_tool for package-provided tools
  • use memory helpers for session or persistent state
  • use emit_event to schedule downstream work
  • use trace for structured diagnostics

Some SDK surfaces are public but intentionally unconfigured in the standalone runtime by default:

  • boxy_agent.sdk.llm.chat_complete
  • built-in web_search

They stay public because Boxy runtimes can provide them. In a standalone SDK runtime they fail explicitly until a host/runtime provider is configured.

CLI

Main commands:

  • boxy-agent create-agent <automation|data-mining> --project-dir <dir>
  • boxy-agent package --project-dir <dir> --output-dir <dir>
  • boxy-agent list-agents [--json] [--registry-file <file>]
  • boxy-agent run --agent <name> [--registry-file <file>] (--event-json '<json>' | --event-file <file>)

Use --registry-file when you want runtime discovery to come from explicit packaged-agent registry records instead of only the current Python environment.

Examples

Reference example projects live in this repository:

  • examples/automation
  • examples/data_mining

They are meant to stay representative of the published authoring flow.

Develop From Source

If you cloned the boxy-agent source repository:

uv sync --all-extras --dev
uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytest

Run the CLI directly from the checkout:

uv run boxy-agent --help

Capability Catalog

The CLI and compile/package APIs load the packaged capability catalog from src/boxy_agent/capability_catalog.toml.

Treat that catalog as the shipped contract for discoverable data queries, Boxy tools, and built-in tools. It is generated data and should not be edited by hand.

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

boxy_agent-0.2.0a2.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

boxy_agent-0.2.0a2-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file boxy_agent-0.2.0a2.tar.gz.

File metadata

  • Download URL: boxy_agent-0.2.0a2.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for boxy_agent-0.2.0a2.tar.gz
Algorithm Hash digest
SHA256 ad2a34d2152d273ec6e5961bbcac91bdcac265a249d07cb2103b884b0a8c18b1
MD5 b88bc3d13f3712fe129e1e9292c98492
BLAKE2b-256 97af4ce76be5bd27fb041f4ea518fefbca236c547aa972a4c76fe924374377c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for boxy_agent-0.2.0a2.tar.gz:

Publisher: boxy-agent-release.yml on boxy-ai/boxy

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

File details

Details for the file boxy_agent-0.2.0a2-py3-none-any.whl.

File metadata

  • Download URL: boxy_agent-0.2.0a2-py3-none-any.whl
  • Upload date:
  • Size: 51.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for boxy_agent-0.2.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8445b068a0a75c9bf355c52a674cc2112bd89ddcbbc5c45818e6df2796f901c
MD5 f7a91f8e0e4324e09c06fad84578732e
BLAKE2b-256 6841c58b38bd53dcf84af4cba2e758339dff71d12685d86c57aa4d9ad05641dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for boxy_agent-0.2.0a2-py3-none-any.whl:

Publisher: boxy-agent-release.yml on boxy-ai/boxy

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