Skip to main content

hrns

Pydantic AI agents with server-owned conversations, ACP interaction, and read-only AG-UI streams.

hrns builds a Pydantic AI Agent from capabilities and exposes it over ACP, for terminals and editors.

Install

uv sync --extra client --extra server

Use --extra client for the terminal only and --extra server for the agent and HTTP entry points. The base install provides the shared hrns config, profiles, and mcp commands.

Define the agent

from hrns.server import build_agent

agent = build_agent("anthropic:claude-sonnet-5-5", cwd=".")

The default agent includes coding tools, task tracking, skills, user questions, and approval handling. Compose your own agent with the capabilities reference.

Skills

The agent reads Agent Skills from <workspace>/.agents/skills and ~/.agents/skills by default. A skill is a directory with a SKILL.md; the model sees its name and description, and loads the instructions only when it needs them. A person can list skills with /skills and invoke one with $name; the terminal sends the id, and the server expands the instructions.

[skills]
paths = ["~/shared/skills"]            # libraries read before the defaults
exclude = ["experimental-release-notes"]

build_agent discovers skills by default. Applications can supply Python definitions with Skills(skills=...); see examples/fastapi_app.py. The full reference, including the ACP _meta payloads and the security notes, is in docs/skills.md.

Serve agents

from contextlib import asynccontextmanager
from fastapi import FastAPI
from hrns.server import HrnsServer, build_agent

server = HrnsServer()
coder = server.add_agent("coder", factory=lambda: build_agent("anthropic:claude-sonnet-5-5", cwd="/srv/project"))

@asynccontextmanager
async def lifespan(app: FastAPI):
    async with server:
        yield

app = FastAPI(lifespan=lifespan)
server.mount_acp(app, prefix="/acp")
server.mount_ag_ui(app, prefix="/ag-ui")

Install observation support with uv sync --extra client --extra server --extra ag-ui. Use AcpServer when only ACP is needed. Register multiple factories under different agent IDs. One ACP client may interact with a session while any number of AG-UI clients observe it. Execution survives client disconnects.

Inside the server lifecycle, start work directly:

session = await coder.new_session(cwd="/srv/project")
turn = await session.submit("Investigate the deployment failure")
result = await turn.result()

Follow-ups share a FIFO with ACP prompts. Cancellation and failures pause it; pending_prompts(), resume_queue(), and clear_queue() are Python-only controls. Permissions/questions wait for an ACP attachment. See agent servers for configuration, authentication, stores, and model/provider routing, and AG-UI observation for read-only snapshots and SSE replay.

hrns connect --server ws://127.0.0.1:8000/acp/coder
hrns run --server ws://127.0.0.1:8000/acp/coder "summarize this repo"

Remote hosts require wss://. Pass a bearer token with --token env:NAME or --token keyring:service/user; admitted clients share the agent's server scope. The FastAPI example shows both mounts with authentication.

For the packaged single-agent server:

HRNS_MODEL=provider:model hrns serve --port 8000
# ACP endpoint: ws://127.0.0.1:8000/acp/agent

For stdio:

from hrns.server import build_agent, run_acp_stdio

run_acp_stdio(lambda: build_agent("anthropic:claude-sonnet-5-5"))

hrns acp starts the default agent over stdio; hrns agent uses the configured models and provider routing. The terminal uses the same configured entry point.

Configuration

The client and server read one document: config.toml in the platform config directory, with an optional hrns.toml in the working directory overriding it key by key. HRNS_* environment variables override both. Configuration is the field reference and the location map.

hrns agent launches the ACP entrypoint with the configured provider and model. The terminal client reuses that entrypoint, so it passes the same document to it.

In the TUI connection picker, l opens provider management. Add or edit a provider to paste its API key into the password field; the key is stored in the OS keyring. After saving a provider without an active model, the model picker opens so a catalog or custom id can be selected. /model provider:model also sets it directly.

/providers acts on whatever you are connected to. Over stdio to hrns agent it opens the entry editor above; connected to a remote agent that advertises provider configuration it lists that agent's providers and sends providers/set / providers/disable for you.

hrns agent seeds its ACP provider registry from those TOML entries, so a client that speaks providers/* sees one provider per entry and can reroute it to its own gateway. The entry this deployment starts with is marked required, because disabling it would leave the default session without a model; the headers a client sends reach the request as extra_headers model settings.

Runtime behavior

  • Run one worker per server. Sessions, queues, pending interactions, and observation live in the process. Durable session stores restore committed state after restart.
  • Provider routing changes apply on the next turn. A running turn keeps its selected endpoint; session setting changes apply before its next model request.
  • MCP exports require client consent at session start. Headless clients export servers configured with always_allow = true. The /mcp panel shows startup and authentication failures. See MCP over ACP for the request scope and upstream behavior.
  • Tool approvals are enabled by default. Reads run freely; file writes and shell calls request permission through ACP. approval=False delegates approval to the deployment.

Metadata

Release files for hrns 0.0.20

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

Source distribution (sdist)

Source distribution for hrns 0.0.20
File Size Uploaded Provenance Actions
hrns-0.0.20.tar.gz 236.6 kB With provenance Details for hrns-0.0.20.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hrns 0.0.20
File Interpreter ABI Platform Actions
hrns-0.0.20-py3-none-any.whl Python 3 none any Details for hrns-0.0.20-py3-none-any.whl

Total release size: 528.5 kB

Release files / hrns-0.0.20.tar.gz

Download URL hrns-0.0.20.tar.gz
Size 236.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5a1e77df862914d00618d334d85a4b56328c62f8def1ce9ca2eccb7a9e744ce8
BLAKE2b-256 checksum
How to use checksums
99cb8893d50db4bb956616a51a990df085c75a6e144c02d681c3b3ab1719f108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / hrns-0.0.20-py3-none-any.whl

Download URL hrns-0.0.20-py3-none-any.whl
Size 291.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a65acb34523423792a1855b2a3b3e64d8ae8c30af80de4f662a8851a6c811477
BLAKE2b-256 checksum
How to use checksums
1ccced2e8b9522ba4f242abf83d4190a4ac8042179c24b260eeba3b26e9f9124
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Security for hrns 0.0.20

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hrns-0.0.20.tar.gz

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 Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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