Skip to main content

hrns

hrns logo

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

uvx hrns

Or install with pip install hrns. Both include the terminal client and server.

For a minimal installation, use hrns-slim, adding [client] for the terminal or [server] for the agent and HTTP entry points. Without extras, it provides the shared hrns config, profiles, and mcp commands. Python imports and the command remain hrns.

For local development, run just install.

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 session: build_agent("anthropic:claude-sonnet-5-5", cwd=session.cwd))

@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 pip install 'hrns[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.27

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.27
File Size Uploaded Provenance Actions
hrns-0.0.27.tar.gz 4.8 kB With provenance Details for hrns-0.0.27.tar.gz

Built distribution (wheel)

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

Total release size: 9.6 kB

Release files / hrns-0.0.27.tar.gz

Download URL hrns-0.0.27.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
36883b5f6a36e0a345b208e4ae28ef6683e5addebf14c024f060675a0be24c52
BLAKE2b-256 checksum
How to use checksums
e423c55b96b5ed64ed101b16554eada34ecc0f0d3d4190df3c65ce8014e057b8
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 17, 2026.

Transparency log

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

Download URL hrns-0.0.27-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1baaa5ae349af67bda3a9d888145af8ad9eafb9c3dae0e8a81b91813c8997253
BLAKE2b-256 checksum
How to use checksums
9b9bc8b05797b0aec350da916c9b7755b6f746d0213982b60578cf006641f05c
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 17, 2026.

Transparency log

Security for hrns 0.0.27

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.27.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 17, 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