agntk

April 6, 2026 · View on GitHub

npm version npm downloads license

AI agent you install and point at problems. Zero config. Works immediately.

npx agntk "fix the failing tests"

No API keys required — a free tier is included. Bring your own key or install Ollama for unlimited local use.


Quick Start

# One-shot: give it a task
npx agntk "organize this folder by file type"

# Named agent: remembers context across sessions
npx agntk -n coder "refactor the auth module to use JWT"

# Interactive REPL
npx agntk -n coder -i

# Pipe input
cat error.log | npx agntk "explain these errors and suggest fixes"

# List your agents
npx agntk list

# Inspect or manage an agent
npx agntk info coder
npx agntk clean

That's it. No config files. No API key setup (unless you want to). It reads your files, runs commands, browses the web, spawns sub-agents, and remembers what it learns.

After any one-shot prompt, you can type follow-up messages directly — the agent stays in the terminal and remembers the conversation. Use -q to disable this and exit immediately.


What It Does

Out of the box, every agent has 20+ built-in tools:

  • Files — read, write, edit, create, glob, grep across your workspace
  • Code — AST-aware search and replace via ast-grep
  • Shell — run commands, manage background processes
  • Browser — navigate, extract, interact with web pages
  • Planning — break down complex tasks, deep reasoning for hard problems
  • Memory — remember facts, recall context, build knowledge across sessions
  • Sub-agents — spawn specialized agents for parallel work, with live activity streaming
  • Skills — auto-discover SKILL.md files for project-specific capabilities
  • Governance — three-tier behavioral framework (CORE identity > human rules > agent instincts)
  • Growth loop — agents log events, synthesize daily journals, and create learned instincts

Zero-Config Provider Cascade

agntk auto-detects the best available AI provider:

PriorityProviderHow it's detected
1Your API keyOPENROUTER_API_KEY, OPENAI_API_KEY, or CEREBRAS_API_KEY in env
2OllamaAuto-detected at localhost:11434 — picks the right model for your hardware
3Free tierBuilt-in, no setup — backed by Cerebras (rate-limited)
# Use your own key for unlimited access (recommended)
export OPENROUTER_API_KEY=sk-or-...

# Or use local models — just install Ollama, agntk finds it automatically
# https://ollama.com

# Or just run it — the free tier works out of the box
npx agntk "hello"

CLI Reference

agntk "prompt"                    Run a one-shot task
agntk -n <name> "prompt"          Named agent (persistent memory)
agntk -n <name> -i                Interactive REPL
agntk list                        List all agents
agntk info <name>                 Show agent details
agntk delete <name>               Delete an agent's state
agntk stop <name>                 Stop a running agent
agntk clean                       Interactively remove stale agents
agntk completions <shell>         Output shell completion script
agntk install <file.md>           Install a capability into the agent's harness
agntk uninstall <path>            Remove an installed capability
agntk evaluate <file.md>          Validate a capability file

Options

FlagShortDescription
--name-nAgent name (enables persistent memory)
--instructionsCustom system prompt
--interactive-iInteractive REPL mode
--workspaceWorkspace root (default: current directory)
--max-stepsMax tool-loop steps (default: 25)
--verboseShow full tool args and output
--quiet-qText output only (no follow-up, for piping)
--version-vShow version
--help-hShow help

Agent Management

CommandDescription
listShow all agents with status (running/idle) and last active time
info <name>Agent details — memory files, workspace, sub-agents, token usage, disk size
delete <name>Delete an agent's state directory (with confirmation)
stop <name>Send SIGTERM to a running agent; SIGKILL if it doesn't exit
cleanInteractive picker to bulk-delete idle agents
completionsOutput shell completion script (bash, zsh, fish)
installValidate and install a capability (rule, instinct, skill) into the harness
uninstallRemove an installed capability file
evaluateValidate a capability file without installing it

Interactive REPL

In REPL mode (-i or follow-up after one-shot), press TAB after / for autocomplete:

CommandDescription
/helpShow available commands
/toolsList available tools
/agentsList all agents
/modelShow current model info
/memoryShow agent memory files
/statusShow session stats
/verboseToggle verbose output
/clearClear conversation history
/exitQuit the REPL

Shell Completion

Tab completion for commands, flags, and agent names in your shell:

# Install globally for shell completion
npm i -g agntk

# Completions auto-install on first run (bash/zsh/fish)
# Or generate manually:
agntk completions zsh

When installed globally, agntk auto-detects your shell, writes the completion script to ~/.agntk/completions/, and patches your rc file. No manual setup needed.

Examples

# Fix bugs
npx agntk -n coder "the login page crashes when the session expires — find and fix it"

# DevOps
npx agntk -n ops --instructions "you manage k8s deploys" "roll back staging"

# Research
npx agntk "compare React Server Components vs Astro islands — pros, cons, benchmarks"

# Code review
npx agntk "review src/ for security issues and suggest fixes"

# Pipe anything
git diff | npx agntk "write a commit message for this diff"
cat package.json | npx agntk "are any of these dependencies outdated?"

# Agent management
npx agntk info coder
npx agntk delete old-agent
npx agntk clean

Named Agents & Memory

Give an agent a name and it remembers context across sessions:

# First session — agent learns about your project
npx agntk -n myproject "read the codebase and understand the architecture"

# Later session — agent already knows the context
npx agntk -n myproject "add rate limiting to the API endpoints"

# See what agents exist
npx agntk list

Memory is stored at ~/.agntk/agents/{name}/ as plain markdown files:

PathDescription
memory/memory.mdAgent-curated facts about your project
memory/decisions.mdAppend-only log of decisions made
memory/preferences.mdCross-project preferences
memory/identity.mdHuman-authored identity (you can edit this)
memory/project.mdHuman-authored project context
context.mdSession context the agent rewrites as it learns

Hardware-Aware Local Inference

When Ollama is detected, agntk checks your hardware and picks the largest model your system can run comfortably:

Your RAMModel SelectedWhy
8 GBqwen3:8b for everythingFits in memory with room for OS
16 GBqwen3:14b standard, qwen3:8b fastBest balance of quality and speed
32+ GBqwen3:32b reasoning, qwen3:14b standardFull power for complex tasks

Apple Silicon unified memory, NVIDIA VRAM, and CPU-only systems are all detected automatically. The agent tells you what it picked:

  provider: ollama (http://localhost:11434)
  models:   32 GB RAM → qwen3:32b for reasoning/powerful, qwen3:14b for standard

Harness Governance

Agents can operate under a three-tier governance system that defines behavioral boundaries:

TierDirectoryAuthorPurpose
COREcore.mdHumanFrozen identity — purpose, values, ethics
Rulesrules/HumanBehavioral boundaries the agent must follow
Instinctsinstincts/AgentLearned behaviors from experience (draft by default)

Enable governance on any agent:

const agent = createAgent({
  name: 'governed-agent',
  harness: { root: './harness' },
});

The agent automatically gets a create_instinct tool to persist learned behaviors. Events are logged for daily journal synthesis, closing the growth loop.

# Install a capability file
agntk -n myagent install rules/safety.md

# Validate before installing
agntk evaluate my-instinct.md

For Developers

The CLI is built on @agntk/core, which you can use directly in your own projects:

import { createAgent } from '@agntk/core';

const agent = createAgent({
  name: 'my-agent',
  instructions: 'You are a helpful coding assistant.',
  workspaceRoot: process.cwd(),
});

const result = await agent.stream({ prompt: 'Read package.json and list the dependencies' });

for await (const chunk of result.fullStream) {
  if (chunk.type === 'text-delta') process.stdout.write(chunk.text ?? '');
}

Packages

PackageDescription
agntkCLI — npx agntk entry point
@agntk/coreAgent factory — tools, streaming, memory, sub-agents, hooks
@agntk/cliCLI implementation
@agntk/serverHTTP server — REST + SSE + WebSocket endpoints
@agntk/clientClient library — HTTP, SSE, WebSocket
@agntk/searchWeb search with provider fallback (DuckDuckGo, Brave, etc)
@agntk/loggerStructured logging with namespace filtering

Custom Tools

const agent = createAgent({
  name: 'my-agent',
  tools: {
    myCustomTool: {
      description: 'Does something custom',
      parameters: z.object({ input: z.string() }),
      execute: async ({ input }) => ({ output: `Processed: ${input}` }),
    },
  },
});

Custom tools are merged with the 20+ built-in tools.

Model Tiers

Every provider has 4 model tiers. Override via environment variables:

TierPurposeEnv Override
fastQuick responses, low costAGENT_SDK_MODEL_FAST
standardBalanced quality/costAGENT_SDK_MODEL_STANDARD
reasoningComplex logic, planningAGENT_SDK_MODEL_REASONING
powerfulBest quality, highest costAGENT_SDK_MODEL_POWERFUL

Server & Client

Expose any agent as an HTTP API:

import { createAgentServer } from '@agntk/server';
import { createAgent } from '@agntk/core';

const agent = createAgent({ name: 'api-agent', instructions: 'You help with API tasks.' });
const server = createAgentServer({ agent, port: 3000 });
server.start();
// POST /stream, POST /chat, GET /health, WS /ws/browser-stream

Connect from anywhere:

import { AgentHttpClient } from '@agntk/client';

const client = new AgentHttpClient('http://localhost:3000');
for await (const event of client.generateStream({
  messages: [{ role: 'user', content: 'Hello' }],
})) {
  if (event.type === 'text-delta') process.stdout.write(event.textDelta);
}

Advanced Features

Available via sub-path imports:

import { ... } from '@agntk/core';          // Core essentials
import { ... } from '@agntk/core/evals';     // Eval suite and assertions
import { ... } from '@agntk/core/advanced';  // Durability, hooks, guardrails, reflection, observability

Features include: durable workflows (crash recovery), workflow hooks (human-in-the-loop approval), guardrails (PII filtering), reflection (always-on self-critique), observability (Langfuse + OpenTelemetry), and best-of-N evaluation.


Requirements

  • Node.js >= 20
  • For local models: Ollama (optional, auto-detected)

License

MIT