ph-utcp
Tools published as UTCP manuals, as tools a pH agent can call.
One row, utcp. Give it a manual call template — the object any UTCP harness
registers — and every tool the manual names becomes a pH tool: in the prompt,
through the pipeline, in the log, and in Code Mode's listing.
- id: utcp
name: utcp
config:
manuals:
- template:
name: weather
call_template_type: cli
commands:
- command: weather-tools manual
state: weather # a directory of the calling agent's scratch, for what it builds
writable: [] # shared paths outside the workspace its commands may write
tools:
forecast:
concurrency_safe: true
effect_free: true
A UTCP tool sees what its agent sees
A cli tool's command is started by ctx.shell for the agent making the call:
in that agent's workspace, under that agent's sandbox, and ended by the call's
own cancellation. That makes a UTCP tool bounded the way bash is bounded.
permissions-fs does not apply to it. Those rules govern calls through
ctx.fs, and a subprocess is not one. What bounds a UTCP tool's reads and writes
is the sandbox.
Where a tool keeps what it builds
A tool that builds something about a tree — an index, a graph — changes no file of it, so a read-only session should not stop it, and should still stop it writing the tree. Two settings say where such a tool writes:
statenames a directory for the tool's working state. Each call's command is told$PH_TOOL_STATE=<the calling agent's scratch>/<state>. The scratch is writable under every sandbox mode; the workspace only underworkspace-write. It is per session and agent, so two agents never share state, and an agent that restarts is told the same directory and finds what it built. A tool made withph.toolclireads it withstate_dir().$PH_TOOL_AGENTnames the agent that state belongs to, for a tool that asks the session to do something on that agent's account — the text index's embeddings through a model route are recorded in that agent's log. It is a word from inside a sandbox: a session uses it for bookkeeping and grants nothing by it.- Temporary files go in the scratch too. Every confined command gets
TMPDIR=<the agent's scratch>from the shell seam: the sandbox leaves it no writable/tmp, and a model library that makes one temporary file would otherwise fail there. writablenames paths outside the workspace that agents share: a grammar cache, a model's weights. A grant holds under every sandbox mode. One that overlaps the workspace — inside it, the root itself, or a directory containing it — is refused and reported inphern doctor, because honoring it would make the repository writable in a session whose person said it is not. So a deployment whose workspace contains$PH_CACHE(a session started in the home directory) gets no grant under the cache.
A host, for a manual whose tools are slow to start
- template: { name: notes, call_template_type: cli, commands: [{command: ph-notes manual}] }
state: notes
host:
command: [ph-notes, serve] # a `ph.toolcli` command, up to and including `serve`
label: notes index # what the footer and the completion note call it
warm: [notes_index] # tools it calls once when started unasked
eager: true # start it at a root agent's first step
idle_s: 900
A manual can name a command that stays up and answers its tools on a socket, so what they load — an embedding model — is loaded once, and a long piece of work goes on past the call that asked for it. The row keeps one running for each tree an agent works in:
- Started as every command is: by
ctx.shell, for the agent, in its workspace and under its sandbox. Each call is told the socket in$PH_TOOL_HOST; a command that finds nobody there runs by itself, so a host is never required for a call to be answered. - A job of the agent it serves (
ctx.jobs). It ends when the agent does and when the manual's row unmounts, leaves by itself when idle, and is started again by the next call. A daemon that restarts starts a new one; nothing is picked up, and nothing needs to be, because what the tools build is on disk. - One a tree, not one an agent. A child builds its own only when it has a
tree it writes for keeps: a worktree, an overlay. One in its parent's checkout,
or granted only to read the project —
readonly-scratch, and the two ephemeral kinds — uses its parent's host and its parent'sstate, and its commands run in that tree, which is how aph.toolclicommand is told its root. So a read-only fan-out is one index and one host however many children it has. An answer about a tree other than the asking agent's own says so. eagerstarts it at a root agent's first step with thewarmtools to call, so an index is being built before anything asks for it — once for each tree, and without holding the step up. A host that leaves when idle is started again by the next call, not the next step, so an unchanged tree is not indexed again for nobody.- Progress and its end. A host's tools report to
progress.jsonin the state directory. While one works the footer says how far it has got ("notes index 120/539 documents"); when it ends, and somebody is owed word of it — a call was answered "still going", or the host began the work unasked — the agent is told, with a note that waits for its next step and starts no turn. The note carries what the run itself has to say of its end (Progress.note): what the tool's result would have told a caller that waited.
Sockets are under $PH_RUNTIME/utcp, granted to the host and to each call. A
deployment with no job runner or no usable runtime directory runs every call by
itself.
What a manual cannot say
UTCP describes a tool with a name, a description and two schemas. pH's scheduler
and policy rows also read whether two calls may overlap and whether a call has
effects. Each defaults to the careful answer — not safe to overlap, has effects —
and the manual's tools table states otherwise per tool.
A UTCP tool has no idempotency key and no reconcile, so after a crash mid-call
its outcome is unknown to the model, as DESIGN.md says of any such tool.
A provider that is down
A manual whose discovery fails is skipped: a warning in the log, a line under
"UTCP tools" in phern doctor, and a note in the system prompt naming the
provider, so the model does not go looking for a tool that is not there. The
mount goes ahead with the manuals that answered.
Protocols
cli is allowed by default, because it is the one this row runs through pH's
own doors. Another protocol — http, mcp — runs inside the harness process by
the UTCP library's own client, outside the sandbox and its egress rules. To use
one, install its plugin (utcp-http, utcp-mcp) and name it in protocols.
Credentials
A template's ${VAR} references are resolved from the environment when a call is
made. This row stores no values.
A command's environment starts as the deployment's scrubbed one, which drops
every variable whose name looks like a credential, and a template cannot name
its way past that. A manual's pass_env is how a deployment says one may pass:
the names of variables read from the harness's own environment each time one of
the manual's commands is started — a tool call, or its host — and set on that
command alone.
Publishing a pH tool as a manual
ph.toolcli turns a package's rows into a command line with a manual
subcommand; see docs/cookbook/adding-a-tool.md. A manual written that way sets
envelope: true, and its tools then read to an agent exactly as they would
registered in-process: the same value, the same rendered text, the same error
codes.
Metadata
Release files for ph-utcp 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ph_utcp-0.11.0.tar.gz | 30.9 kB | Without provenance | Details for ph_utcp-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ph_utcp-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for ph_utcp-0.11.0-py3-none-any.whl |
Total release size: 57.0 kB
Release files / ph_utcp-0.11.0.tar.gz
| Download URL | ph_utcp-0.11.0.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab0f619dca246d97a90a51a8a7a91b3a669cbc8132412d25811d28389a581262
|
|
BLAKE2b-256 checksum How to use checksums |
fd1bbbf6787d698bf0e3dec4015c11c1dcef72ca836b08afb89c373bb40e5445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / ph_utcp-0.11.0-py3-none-any.whl
| Download URL | ph_utcp-0.11.0-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b858cb8db6dba815e000c2b8db38ae57284b8875fecd314fb44ed9a17f7833ea
|
|
BLAKE2b-256 checksum How to use checksums |
28db8714f81511bd211a910bbce3cbaba4138ad5dc71d0a2366c4038b3a53c50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for ph-utcp 0.11.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.