halo-format-claude
Halo adapter for Claude on two runtimes (Python): the Claude Agent SDK and the raw Claude Messages API. Same engine — encode a large tool result, hand the model a shape map, let it pull back only the leaves it needs, verified on read — bound to whichever loop you run.
Agent SDK — install_halo()
install_halo() wires the adapter in one call (install the Agent SDK extra:
pip install halo-format-claude[agent-sdk]):
- a PostToolUse encode hook that replaces a large tool result with a halo shape map (root kind + one line per field: ref, kind, and a bounded preview), so the payload stays out of the model's context while it still sees what's there;
- a single in-process
halo_fetchMCP tool the model uses to pull back only the leaves it needs, verified on read — a ref that lands on a branch returns that branch's sub-refs, so one batch API both pulls and expands (there is no separatehalo_walk).
from claude_agent_sdk import ClaudeAgentOptions, query
from halo_format_claude import install_halo
result = install_halo(ClaudeAgentOptions(...))
# pass result.options to query(); result.session holds the shared store for audit/inspection
The encode hook is deterministic plumbing (it always fires, even for built-in tools); the Halo Skill
is the navigation guidance. Pass store=FileStore(dir) for the heavy/persistent deployment.
Raw Messages API — halo_format_claude.raw
No hook exists on the raw API — you own the tool-use loop on messages.create(...). create_raw_halo()
gives you the same mechanism to drive by hand. This submodule imports zero Agent SDK code (the
package imports the SDK lazily), so pip install halo-format-claude without the agent-sdk extra is
enough for the raw path. This is the runtime where Halo's token win is largest: the raw API re-sends
every tool result in context each turn, so keeping a heavy payload out of context is a real, growing
saving.
import json
from anthropic import Anthropic
from halo_format_claude.raw import create_raw_halo
halo = create_raw_halo(threshold=2048)
tools = [*domain_tools, halo.tool_def] # add the halo_fetch tool
system = SYSTEM_PROMPT + halo.guidance # add the navigation guidance
# inside your loop, per tool_use block:
async def run_tool(name, args):
if halo.is_fetch(name):
return halo.fetch(args["refs"]) # verified leaves; never re-encode
result = await dispatch[name](**args)
return halo.encode_result(name, args, result) # shape map if large, else passthrough
encode_result size-gates (shape map above the threshold, raw JSON below); fetch returns the
verified per-ref results as a JSON string for the tool_result content. The core engine is
halo-format; this package is only the shim that binds it to
the two Claude runtimes.
Metadata
Release files for halo-format-claude 0.4.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 |
|---|---|---|---|---|
| halo_format_claude-0.4.0.tar.gz | 18.8 kB | With provenance | Details for halo_format_claude-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| halo_format_claude-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for halo_format_claude-0.4.0-py3-none-any.whl |
Total release size: 37.8 kB
Release files / halo_format_claude-0.4.0.tar.gz
| Download URL | halo_format_claude-0.4.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd6d52e8f46e2023669fdcc371169586156d4a7c65040efb2b34124e635a53c1
|
|
BLAKE2b-256 checksum How to use checksums |
90bb3ca51905be774d61ed23f613aa6b832a1cf26073cb7881bf8ac31be70e21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / halo_format_claude-0.4.0-py3-none-any.whl
| Download URL | halo_format_claude-0.4.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11087ac2d49a9f5a73565b5ff8a10f1ce397d68fdd61fc81ad808e1774078914
|
|
BLAKE2b-256 checksum How to use checksums |
dbb8f102ba511a812c069a5dee3c1d609572d77ed7f5f1373771f825e495bdda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logSecurity for halo-format-claude 0.4.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for halo_format_claude-0.4.0.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 Jun 7, 2026.
Transparency logA 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.