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      # installs the provider binary
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.

During local development of the in-repo OpenAI provider:

pip install ./providers/openai
newt-provider-openai --help

Then configure Newt explicitly. Keep the API key in your shell, secret manager, or ignored env file; do not put it in newt.toml.

[[providers]]
name = "openai"
command = "newt-provider-openai"
model = "gpt-4.1-mini"
tiers = ["FAST", "STANDARD", "COMPLEX", "REVIEW"]
env_pass = ["OPENAI_API_KEY", "OPENAI_BASE_URL"]

OPENAI_API_KEY is required when the provider handles complete or list_models. OPENAI_BASE_URL is optional and defaults to https://api.openai.com.

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.

Learnings from this experiment

Newt is a local-first coding-agent prototype, but the more durable output is what building it teaches about how LLMs actually behave inside a harness. The standout so far:

  • Summarization-induced hallucination — a context-compression harness that summarizes a coding session can make the model hallucinate APIs it had already read. The insight is epistemic, not about bytes: a confident summary is worse than a labelled absence — absence routes the model to re-read; a summary that asserts "the file is known" suppresses recovery and induces plausible-but-wrong completion. A harness's lossy transform silently edits the model's beliefs. (#319)

More field notes from the build:

  • Coder-driving sweet spots — where small local models are and aren't reliable at agentic coding.
  • Truncation honesty (baseline B6) — the measurement that showed silent context truncation yields silently wrong answers, motivating "summarize, don't discard" (which in turn produced the finding above — a reminder that every fix moves the failure, it doesn't always remove it).
  • Causal ordering, not wall-clock — why the conversation store treats timestamps as display claims and orders on signed per-writer ticks + content hashes.

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.8.tar.gz (652.7 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.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.8-cp312-cp312-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

newt_agent_py-0.6.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.8-cp311-cp311-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

newt_agent_py-0.6.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.8-cp310-cp310-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

newt_agent_py-0.6.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

newt_agent_py-0.6.8-cp39-cp39-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: newt_agent_py-0.6.8.tar.gz
  • Upload date:
  • Size: 652.7 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.8.tar.gz
Algorithm Hash digest
SHA256 d79e77dcfa2b327b63ef6fa8dc9cdf4d6cfc155f78cb5f803d3122a1fda8decc
MD5 8d777264fbeb52a27903980e72f1ca65
BLAKE2b-256 76934059bc1955d036e258b1989df17b4bc26abdfc291819e279fc9e992f80e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe242b8ace0be2dd3a17c6d95a8f5fe44b171c6db6f91039add613f6556839ad
MD5 0e703c1efd16c818c5da2375dfd504d0
BLAKE2b-256 9b585254ece7cd07e5edc652f22c481534db6ffa32e61a03bfe1b11246573427

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62446944eea822f3c42d45a46d5114553586916bffab40a4ee7788ea24d6a06b
MD5 0080547e5d22dbc43be83c698c1f8644
BLAKE2b-256 1b43c2386379b16e8168798a34533ec89a3f4448714dd00598547d5aaed0c25b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c527e851bb96a6791390eb463308a7a7b0f7c5a2028b1661dca21189d85d994
MD5 17d62ff44543e1a20217f3704a63b54e
BLAKE2b-256 bfbedaf75477e648b28778f15ab25a33c41eac42419480606699b66b6f629785

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68225f65c616e05febdc6f289b0209407028a11e36fb48da85e2c6091cb955e0
MD5 59ca70fa9cbaed05ff03cfa407838c40
BLAKE2b-256 8c4740f5248d538a82cc4f4e615ada41250d1fe39658e93e05a3f762173d68dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 747f957d768368146959aa6e82d0855b6ecce1b200aae8b1211e3376d36bf474
MD5 c65fdbe2b714e71f924c2150a8b56c39
BLAKE2b-256 011f9e3afa96f01711a26e6fbcc9313b91cdb734ede2b5f7b7e12eef9e5e3751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d72a4d88a30a9d591d3fa703fa810b19f29a52465f98b8856305adddcf155fba
MD5 2a841bd20779a2fe8f7854790c6cfc26
BLAKE2b-256 b5745faf916d914e2ca4948e68c12ea5b473224c1beebd303d02f520206f463e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b58029c46ecb08d5cc2246123dd0ec86a3745b0c45af9c4d0e5c2ade54392ea
MD5 183b67017cfbc526e5cfa573d42bdc9f
BLAKE2b-256 c9f8d402824bf551b780aa3c480d3873eba36c8c4c9184a8999a7cd05681eee3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for newt_agent_py-0.6.8-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86de201e28c17d57aeb9ab632cf432b7e2715aeff91b56b9ae6339138d8212a7
MD5 8ef3a2ba251bdc63a4d78b0cf6ff8ac5
BLAKE2b-256 c48450fc7f95f16a9e863453609950fc325c7293fc8f675156f1f48747459428

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