Get started

Installation

Install the Harnext SDK for Python or TypeScript and point it at a model provider.

Requirements

  • Python: 3.10 or newer.
  • TypeScript / Node.js: Node 20.9+ (the SDK ships ESM and CommonJS builds with bundled type definitions).
  • An API key for at least one provider, or a local model server such as Ollama.

Install

pip install harnext
One distribution, two entry points
The Python package harnext provides both the harnext CLI and the importable SDK. In Node, the CLI lives in the harnext package and the library API in @harnext/sdk. Both speak to the same agent core.

Authentication

The SDK reads provider credentials from environment variables by default, matching the names each provider already uses. Set the key for the provider you intend to use:

.env
# Pick the provider(s) you use
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...

# Optional: defaults for every client in this environment
HARNEXT_PROVIDER=anthropic
HARNEXT_MODEL=claude-opus-4-8

You can also pass a key explicitly when constructing a client — see Client & configuration. Local providers like Ollama need no key; see Providers & models.

Verify your install

from harnext import Harnext, __version__

print("harnext", __version__)
agent = Harnext(provider="anthropic")
print(agent.run("Reply with the single word: ready").text)

CLI check (optional)

If you also installed the CLI, confirm both share the same core version:

Shell
harnext --version
harnext doctor   # checks providers, keys, and runner health
Keep keys out of source control
Never hard-code API keys. Load them from the environment or a secrets manager. The SDK never logs key material, and session transcripts redact credentials passed through tool calls.