Skip to main content

agentd

Run agents behind the OpenAI client API, sandboxed.

  • PTC: the model writes bash/python fences instead of JSON tool calls; MCP servers and @tool functions show up as skills.
  • Harnesses: run Claude Code, Codex, OpenCode or omp through the same API and switch between them mid-conversation.
  • Sandboxes: all agent code runs in a libkrun microVM or a Docker container, with no network and no credentials.
  • Egress: optional network access through a host proxy that injects fnox secrets, so the sandbox never holds them.
  • agentd serve: sessions, background turns and schedules as an API, reachable from other boxes over p2claw.

Install

uv add agentd

Then set up a sandbox:

# macOS (Apple Silicon)
brew tap slp/krun
brew trust --formula slp/krun/libkrun slp/krun/libkrunfw slp/krun/virglrenderer-krun
brew install slp/krun/libkrun
python -m agentd.sandbox.rootfs build agents    # base image (needs Docker)

# Linux (KVM)
agentd-sandbox linux setup

# macOS via Colima (M3+, macOS 15+)
agentd-sandbox colima setup

# or Docker
python -m agentd.sandbox.rootfs build agents

Wheels for macOS arm64 and Linux x86_64/aarch64 include the launcher, agentd-net and (for Linux and Colima) libkrun, so nothing gets compiled. From a checkout, run agentd/sandbox/build.sh first.

agentd-sandbox status shows what's ready. Details, custom images and mounts: docs/sandboxes.md.

PTC

from agentd import patch_openai_with_ptc, display_events, tool
from openai import OpenAI

@tool
def calculate(expression: str) -> str:
    """Evaluate a math expression."""
    return str(eval(expression, {"__builtins__": {}}))

client = patch_openai_with_ptc(OpenAI(), cwd="./workspace")
stream = client.responses.create(model="claude-sonnet-5", input="List files, then calculate 12*12", stream=True)

for event in display_events(stream):
    if event.type == "text_delta":
        print(event.text, end="")
    elif event.type == "code_execution":
        print(f"\n$ {event.code}\n{event.output}")

More: docs/ptc.md.

Harnesses

client = patch_openai_with_ptc(OpenAI(), cwd="./workspace", harness="claude-code")
r = client.responses.create(model="claude-sonnet-5", input="Add a test for utils.py and run it")
r = client.responses.create(input="Review that test", previous_response_id=r.id, harness="codex")

harness= is "ptc" (default), "claude-code", "codex", "opencode" or "omp". Each runs the real CLI inside the sandbox; credentials stay on the host behind a proxy. agentd.available(client) says which harnesses are ready and what models they have. Resume, transcripts, custom model servers: docs/harnesses.md.

Network and secrets

from agentd import KrunExecutor
from agentd.egress import Egress
from agentd.egress.approvals import Approvals

executor = KrunExecutor(egress=Egress(
    allow=["pypi.org", "files.pythonhosted.org"],
    approvals=Approvals(webhook="https://approver.example/hook"),
))

Sandboxes get placeholders; the proxy swaps in real values from fnox only for the hosts, methods and paths its rules allow. Anything else is refused or sent to your approval webhook. libkrun only. docs/egress-and-secrets.md.

agentd serve

agentd serve

Serves sessions over Unix sockets: turns, background runs, schedules, transcripts. Other boxes reach it over p2claw, and agentd.remote.Fleet drives them. docs/agentd-serve.md.

Plain tool calling

patch_openai_with_mcp(OpenAI()) runs MCP tool calls in a regular tool_calls loop with any LiteLLM provider, and uvx agentd config.yaml runs YAML-configured agents that react to MCP resource changes. docs/tool-calling.md.

Coming from 0.8: docs/upgrading-0.9.md.

License

MIT

Metadata

Release files for agentd 0.9.1

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

Source distribution (sdist)

Source distribution for agentd 0.9.1
File Size Uploaded
agentd-0.9.1.tar.gz 4.9 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for agentd 0.9.1
File
agentd-0.9.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
agentd-0.9.1-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
agentd-0.9.1-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details
agentd-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 MB

Release files / agentd-0.9.1.tar.gz

Download URL agentd-0.9.1.tar.gz
Size 4.9 MB
Tags Source
SHA-256 checksum
How to use checksums
f41532ddc98a0a671d58efcf33c9b475b2a16c555125bae0582589e92c9b08f8
BLAKE2b-256 checksum
How to use checksums
ed3951a0478de0a313cc661382e1168650f685c3a822ae9a229c90243d63c8f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / agentd-0.9.1-py3-none-manylinux_2_28_x86_64.whl

Download URL agentd-0.9.1-py3-none-manylinux_2_28_x86_64.whl
Size 2.5 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
cf7778f15994ef1d900932a63ee165d2be3432904698e0d8f011b5d6b52b0db5
BLAKE2b-256 checksum
How to use checksums
03219351ae5f9fe88a0047f1f071fa3441a8f4ca578bfd5e422772ec1b767917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / agentd-0.9.1-py3-none-manylinux_2_28_aarch64.whl

Download URL agentd-0.9.1-py3-none-manylinux_2_28_aarch64.whl
Size 2.1 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a31556883d01264e0331ed32ea04b16f9587727201b20b98f05380e2987a6516
BLAKE2b-256 checksum
How to use checksums
5c1547101963286a039177f0da1b27708790b8f6aa9b8586c1357c9f277be230
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / agentd-0.9.1-py3-none-macosx_14_0_arm64.whl

Download URL agentd-0.9.1-py3-none-macosx_14_0_arm64.whl
Size 2.5 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
7040e06d0ae8d6447ee04f4bac610d5364ba6ecc004d798a8232828add156cc1
BLAKE2b-256 checksum
How to use checksums
7e37b088ff44b3df86f7bd0ed9e3234a042b0c8531eecf1724e6bff0f51dac18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / agentd-0.9.1-py3-none-any.whl

Download URL agentd-0.9.1-py3-none-any.whl
Size 234.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d43dd5b05a4ea931f02142feeb0f92cc10b22bac5e9020c33d7a118134c0534d
BLAKE2b-256 checksum
How to use checksums
d3471df0bb2008227ab7001c2359101506670a1b94f6d096125625bffd2c68ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.0

5 release files

0.9.4

5 release files

0.9.3

5 release files

0.9.2

5 release files

This release

0.9.1 This release

5 release files

0.9.0

5 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

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.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