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.6.tar.gz (255.0 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.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.6-cp312-cp312-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

newt_agent_py-0.6.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.6-cp311-cp311-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

newt_agent_py-0.6.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.6-cp310-cp310-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

newt_agent_py-0.6.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.6-cp39-cp39-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: newt_agent_py-0.6.6.tar.gz
  • Upload date:
  • Size: 255.0 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.6.tar.gz
Algorithm Hash digest
SHA256 f2ca68852395ae7dcb84a4aa5f7783afebf66f61664e98eb428b2ee69cea42aa
MD5 6edf5081adc7102d9d30fac5ad0c86f3
BLAKE2b-256 ebf023a6d6fb15f98b11594418ac7e01d76af3b7759f4b97b2f200fc9a46d6ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9dd2e485d927ff6b19719d30f1e54614a2707b2916a7df11096023601ca5f7a6
MD5 6b880369e6e58b036a8f11d770ec73a0
BLAKE2b-256 f5289f8a77efff5faa83db3723f87e9b11592a6cd7a78cb010e518924ac8e31b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab72874c0ae464c56dcf75ffd8c1292853672b5ce589d8acaa3dab89b4210112
MD5 b3e03a56eaca4edcefb65eb7cdfd8919
BLAKE2b-256 02349b39dfac9cfdf3844af28d3b9b74058d7955bf6745d96f1f096b03342639

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de9c8f2e293e2895916e43c9a533fb465c2a7d0b0538e09c7688b974db7c22cb
MD5 1e159eccaf46738ed3807915e8827334
BLAKE2b-256 a27e1d0442d26c8120656b0fe95f414057ff3215920dfd2e840720bcd3bc7ac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f03f6c052f9077ad054c4496dab00392bf925ae0725e9f927c9fba1cd114eeb
MD5 18bbe110a7b81f7f18ae00888e9cc0ec
BLAKE2b-256 8aec8801ed2377fcdab71733cab87bcccd330968b6a2dfc2f476bd4a852f2039

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7209e34d60d7790fd45fe2961a88a12cbe0adcf54406032fe6055ef09326e90
MD5 fec4b936e2d4492ff450a1c0614e4af5
BLAKE2b-256 4851018aee52c48470e64af57f2257a3c5510574b0d7488e256bface685fbb10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b87f69c9e2d119ae233f799bd98ad45a1a9d5969b84d3c7a41c9e887f2853ee
MD5 fd02e580dd68eb20e7f2d278fba89f03
BLAKE2b-256 eb33f739738d7f512ab64286bddcdd2184b8a369d9885f9066f0645f1f5362fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2759f26312568fbc50d1c4feeb34deb5af3715b9cf298a266596f078eb98e8d
MD5 c941ef89b59ee0e6745042863b36e765
BLAKE2b-256 7f37284533d277cefa28da2b129553c74bf8c8b38a742e84924ec621de5860bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7bc12bd821a023c47160c9d5dcad0ed9c838562deefa78a17e3dc40afb7ac16
MD5 d97fc45a89d29d4968beaa1a26cb9398
BLAKE2b-256 928ef8798f131531272c9ec17d4013b17aec8835c1c5892f38e395d38ec62ef0

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