Skip to main content

Python bindings for newt-agent — agentic coder runtime (newt-core, newt-tools, newt-coder, newt-eval, newt-inference, newt-acp-worker, newt-mcp-server submodules)

Project description

Newt-Agent

Newt-Agent logo

Small, fast, local-first agentic coder. vi to Hermes-Agent's emacs.

Newt-Agent is a single Rust binary with a sharp, minimal tool set. It runs locally against your NVIDIA hardware by default — no cloud bytes leave your machine unless you deliberately install a provider plugin.

Newt is the rewrite of NeMoCode and the successor to drake-agent. It carries NeMoCode's tier-based router (FAST / STANDARD / COMPLEX / REVIEW) and shares the Rust primitives that power Hermes-Thoon, but stops there: Newt is opinionated, not extensible.

Install

Developer install (from source)

Clone the repo, activate a Python virtualenv, and install in editable mode. pip uses maturin automatically as the build backend — no separate maturin install needed.

git clone https://github.com/Gilamonster-Foundation/newt-agent
cd newt-agent
source ~/venv/bin/activate   # or your preferred venv
pip install -e .             # Python library only — installs newt_agent.*

This installs the Python library (import newt_agent) but does NOT put newt on your PATH. The newt CLI is a Rust binary; build it separately:

cargo install --path newt-cli           # installs `newt`
cargo install --path newt-mcp-server    # installs `newt-mcp-server`
newt --help

Changes to Python source in newt-agent-py/python/ are picked up immediately; changes to Rust source require re-running pip install -e . (Python bindings) or cargo install --path newt-cli (CLI binary).

Python library (PyPI)

pip install newt-agent-py

The distribution name has a -py suffix because PyPI's similarity check may block the bare newt-agent against the existing newt package. The Python import path is newt_agent:

from newt_agent.core import Router, Tier
from newt_agent.coder import build_prompt, normalize_emission
from newt_agent.eval import TestCase, RunnerConfig

router = Router()
print(router.classify("rename foo to bar"))   # Tier.Fast

import asyncio
from newt_agent.inference import LocalOllamaBackend, ChatRequest

async def main():
    backend = await LocalOllamaBackend.discover("llama3.1:8b")
    req = ChatRequest()
    req.system("You are a coding assistant.")
    req.user("Hello!")
    reply = await backend.complete(req)
    print(reply.model_id, reply.content)

asyncio.run(main())

Submodules: newt_agent.core, newt_agent.tools, newt_agent.coder, newt_agent.eval, newt_agent.inference, newt_agent.acp_worker, newt_agent.mcp. See each crate's pyo3_module.rs for the bound surface.

Rust CLI binary

The newt CLI is shipped separately from the Python wheel. For now, install from source:

git clone https://github.com/Gilamonster-Foundation/newt-agent
cd newt-agent
just install          # builds release binaries → ~/bin/newt, ~/bin/newt-mcp-server
newt --help

Pass a different destination to override the default ~/bin:

just install /usr/local/bin

Or from crates.io once published:

cargo install newt-agent
cargo install newt-mcp-server

(A pip install-able Python CLI script is planned as a follow-up.)

Modes

newt code [PATH]              # standalone TUI coder
newt pilot <flight-id>        # drake-swarm dashboard
newt worker [--coder]         # ACP worker (stdio JSON-RPC, headless)
newt mcp                      # MCP server (stdio JSON-RPC, headless)
newt doctor                   # health-check local backends + provider plugins
newt config                   # print resolved config

Coder mode

newt worker --coder (or NEWT_CODER=1 newt worker) activates the newt-coder plugin: tasks are handled by injecting the relevant file contents into the prompt and asking the model to emit the complete updated file. The plugin parses the reply, writes any whole-file blocks to the workspace atomically, then captures a real git diff so the foreman gets a hunk-shaped diff to grade.

This closes failure mode T0b (model invents file contents) that the default newt-flat path hits on every local Ollama coder model tested in the 2026-05-29 bake-off. See ~/workspaces/knowledge/board/drake/2026-05-29_newt-coder-failure-mode-taxonomy.md for the failure-mode taxonomy, the bake-off results, and the design rationale.

Per-session opt-in (ACP):

{ "method": "new_session", "params": { "workspace_path": "/path/to/repo", "coder": true } }

Coder-path replies carry an additional emission_shape field on TaskReply ("whole_files", "unified_diff", or "prose") so the foreman's scorecard can distinguish T0a / T0b / T0c instead of lumping them as "empty diff."

Inference, by default, is local

The default binary speaks only to local backends:

  • Ollamaollama-proxy.inference.svc.cluster.local:11434 (in-cluster) with ollama.home.lab / dgx-ollama.home.lab / gnuc-ollama.home.lab fallbacks.
  • vLLM — local OpenAI-compatible HTTP for DGX-served models.

Cloud APIs (OpenAI, Anthropic) require opt-in provider plugins installed separately:

pip install newt-provider-openai      # registers an opt-in provider
pip install newt-provider-anthropic   # registers an opt-in provider

Provider plugins run as subprocesses and speak the Newt-Provider JSON-RPC schema in plugins-protocol/. No cloud client code is compiled into the default Newt binary — the opt-in is enforced at the build level, not by a runtime feature flag.

Evaluation

The newt-eval crate is the end-to-end scorecard for the worker. It spawns the real newt worker binary, drives ACP against a mock or real Ollama, then grades the captured diff with five evaluators (diff_nonempty, diff_applies, rust_compiles, tests_pass, pattern_match).

cargo test -p newt-eval --test mock_e2e   # CI gate (mock Ollama)
just eval                                 # live mode (real Ollama)

See newt-eval/README.md for how to add a new case.

Status

v0.x — workspace scaffold landed; building toward v0.1 (newt worker + LocalOllamaBackend end-to-end).

The work is broken into ~33 drake-flight-sized steps in docs/ROADMAP.md. Each step is one PR, fully tested, ≥80% coverage. See the working design at ~/.claude/plans/flickering-fluttering-otter.md (internal).

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

newt_agent_py-0.6.7.tar.gz (287.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

newt_agent_py-0.6.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.7-cp312-cp312-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

newt_agent_py-0.6.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.7-cp311-cp311-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

newt_agent_py-0.6.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.7-cp310-cp310-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

newt_agent_py-0.6.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.7-cp39-cp39-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file newt_agent_py-0.6.7.tar.gz.

File metadata

  • Download URL: newt_agent_py-0.6.7.tar.gz
  • Upload date:
  • Size: 287.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for newt_agent_py-0.6.7.tar.gz
Algorithm Hash digest
SHA256 dff2ff9a222125e2572aa57e4606be0ed633223e48edd81c7fc5eaee95fc0535
MD5 13dce555169e15b45fb93c041c836198
BLAKE2b-256 50adfe5c7dad75b5312b7bb73a6200a82381d9568eff176d379889f0e8bce6ac

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07102025de260c09b7fb348151ee3084a0934c81c6a457372a3a1f7d06fc1172
MD5 fa8dfecce867f9e156cdbe1f661511b8
BLAKE2b-256 38afeaf88ce1f9a5681bde59d6bc95a1574d68b9ffc716487800eb06d5d52a55

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e3236e3fc8fbc8ab389b0879984f9fa581d4cddf084a3520c7bb8fe587f6900
MD5 b7c139fe31f4c5a834c0530cd6ec7b42
BLAKE2b-256 7589e63cf3bd89a0cba197de947f565ff28c5d264f98bc6450cb77462e451a74

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e61bf5b1dcf7ba2a8a2bca655c9ca53eabe0bed531dedb61934ec5299810fae
MD5 3cf3c5143d6f74565a051fc50f482a37
BLAKE2b-256 33a7fd8a255ca98f7679f3e5e44acf35225e0f06f357c627677dc7adfc54a540

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aea0a3e7f9ac484ac35900053ed03b61599fac59484373dc8baa9a806d438fb3
MD5 0f02f205bd32f6c16c923be9f753b985
BLAKE2b-256 f1d1e24764fd049ee409ee080ad057b7576716ca1eb5b87b18da11e71aafc3fe

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12a65689dc8664947c020d64021c3afe23f9b1aa4170b39d898713e7b5f1715a
MD5 50fc67b2fc31f6b6e78601323eee1b11
BLAKE2b-256 8c7fbdfc9cd51dc27c12bb8cbfc6b5f98eebe939f9beacfa9d597a8d622a1ceb

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a168e7a0b9510e986b6b7f623cd872a7281dc1fd1503b968085a31a4f341aabc
MD5 6436c066a004db870e396b155be06e39
BLAKE2b-256 7d00d8f7fa197b9f6d792ee79b584ebcd6c4903e1218f12b877230c1c54b2c16

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c04c16c6132632d32834a075841379ed98e5a1d8fbdc0d7586ec735fd68dbb26
MD5 7b0c6ff142af40e405aafb9ee4b44fb5
BLAKE2b-256 cfa9a1be20eadbafdb2837f34c0241e2466ea79ac6e8557b5877794453fe038d

See more details on using hashes here.

File details

Details for the file newt_agent_py-0.6.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_py-0.6.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a292a4157f8d3fe6e0aa1fc3ed20816cbaf40dc805c2df5766b62fffa0f3865e
MD5 e8cb6413e4346fb738d69d91885ad216
BLAKE2b-256 37d2abbe928276a0c7aeb512172283e03a25026057a4ac2c358b9cd59445bea6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page