Harnext SDK
Drive the harnext coding agent from your own code. The same agent that powers the CLI — read, write, edit, run shell, drive MCP, and ship issues to PRs — available as first-class Python and TypeScript libraries.
harnext is a minimal, provider-agnostic coding agent. The CLI gives you an interactive REPL and a GitHub Actions harness; the SDK gives you the same executor as a library, so you can embed the agent in scripts, services, notebooks, test suites, and your own automation. One agent, six tools, 20+ providers — now callable from Python and TypeScript with matching APIs.
from harnext import Harnext
agent = Harnext(provider="anthropic", model="claude-opus-4-8")
result = agent.run("Add input validation to the signup endpoint")
print(result.text)snake_case; TypeScript uses camelCase. Where they differ beyond casing, it's called out explicitly.What you can build
The SDK exposes every capability of the agent as a typed API. Pick a section to dive in:
One-shot run() for results, or stream() for token-by-token events and live tool calls.
The six built-in tools — read, write, edit, bash, skill, mcp — plus your own typed custom tools.
Anthropic, OpenAI, Google, Ollama and 20+ more. Switch per call with a single argument.
Persistent, inspectable sessions in ~/.harnext. Resume, replay, and export any run.
Bundle reusable skills and connect any MCP server in proxy or direct mode.
Generate the GitHub Actions pipeline and manage a self-hosted runner — all from code.
How it fits together
A Harnext client wraps a provider, a working directory, and a set of tools. Calling run() or stream() starts an agent loop: the model thinks, calls tools, observes results, and repeats until the task is done or max_turns is reached. Every run is recorded as a session you can resume or replay. The same client can also build a harness — emitting the GitHub Actions workflows that let the agent pick up issues and open PRs unattended.