SDK

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)
Same surface, two languages
Every concept in this reference is documented for both SDKs side by side. Python uses 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:

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.

New to harnext?
Start with Installation, then the Quickstart. If you already have the CLI, the SDK ships in the same distribution — jump straight to the SDK overview.