Skip to content

[claude] Local mode: Client.local() + LocalRuntime (generated from sdk-codegen)#185

Draft
cm2435-hcomp wants to merge 7 commits into
mainfrom
claude/sdk-local-mode
Draft

[claude] Local mode: Client.local() + LocalRuntime (generated from sdk-codegen)#185
cm2435-hcomp wants to merge 7 commits into
mainfrom
claude/sdk-local-mode

Conversation

@cm2435-hcomp

Copy link
Copy Markdown

What

Adds local execution to the Python SDK (plan 002 of eng_plans/30-06-2026-agent-api-local-runtime):

from hai_agents import Client
client = Client.local()                      # installs/finds/spawns the runtime binary
session = client.run_session(agent=..., messages="...", tools=[...])

A new hai_agents.local package (LocalRuntime + Client.local/AsyncClient.local) manages the hai_agent_runtime binary — verified install, loopback spawn with a generated bearer token, health poll, cross-process attach/force-kill — then hands back a normal Client pointed at the local endpoint. Sessions, polling, custom tools, and answer schemas work unchanged.

Why

Local execution should be a first-class SDK target, not a HoloDesktop-private path. Base hai_agents stays lightweight — import hai_agents never loads hai_agents.local or touches the network; local mode is opt-in via the local extra.

How

This mirror's src/hai_agents/ is Fern-generated output; the hand-written local-mode code lives as .static overlays in agent_platform (companion PR #1452) and is copied in by generate.sh. This PR carries the generated result plus the mirror-owned pyproject.toml (the local extra) and tests.

Validation

  • Mirror suite: 108 passed, 8 skipped (+28 tests)
  • Regeneration survival proven — a real Docker/Fern regen reproduces this tree byte-for-byte (overlays survive)
  • Live check passed against the real 0.1.8 binary via HAI_AGENT_LOCAL_BINARY_PATH (spawn, health, shutdown_if_idle through the generated client)

⛔ SHIP-GATE

The manifest's 3 literals (version + 2 sha256s) come from the overlay in #1452 and must repoint to the plan-005 release binary before merge.

Notes

Companion (required): agent_platform #1452 (the overlays). Consumer: holo-desktop-cli (plan 003) depends on the published hai-agents[local].

🤖 Generated with Claude Code

cm2435-hcomp and others added 7 commits July 4, 2026 17:06
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Task-8 audit: every local-mode test exercises a public entry point and
guards a likely regression; no scaffolding to prune. Only change is an
isort fix in test_client_local.py flagged by ruff.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant