Skip to main content

Agentik - a CLI-first, modular agent framework that runs LLMs via OpenRouter.

Project description

Agentik (A CLI‑First Modular Agent Framework)

Agentik is a developer‑friendly framework for building LLM agents that run via OpenRouter. It emphasizes: clean YAML configs, a batteries‑included CLI, pluggable tools with safety policies, rich JSONL transcripts, and a dev watcher for rapid inner‑loop iteration.


Table of Contents

  1. Prerequisites

  2. Installation

  3. Configure OpenRouter

  4. Verify Setup

  5. Quick Start

  6. Configuration Primer

  7. CLI Reference (with Windows PowerShell and macOS/Linux examples)

    • version, self-test, init
    • new (agent|tool)
    • template (list|apply|pull)
    • run
    • dev watch
    • keys (set|show)
    • models list
    • tools (list|info|run)
    • validate file
    • batch run
    • memory (init|recall|summarize|clear|path)
    • eval run
    • config path
  8. Built‑in Tools & Policies

  9. Transcripts & Cost Estimation

  10. Quick Reference Table

  11. Troubleshooting

  12. Development


Prerequisites

  • Python 3.10+

Installation

Windows (PowerShell)

pip install agentik-framework

macOS/Linux

pip install agentik-framework

Configure OpenRouter

Agentik uses OpenRouter for LLM calls. Provide your key via env var or store it in Agentik’s RC.

Windows (PowerShell)

setx OPENROUTER_API_KEY "sk-or-XXXXXXXXXXXXXXXX"
# Close & reopen PowerShell so the env var is available in new sessions

macOS/Linux (bash/zsh)

echo 'export OPENROUTER_API_KEY="sk-or-XXXXXXXXXXXXXXXX"' >> ~/.bashrc
source ~/.bashrc   # or: source ~/.zshrc

Store via Agentik RC (either scope):

agentik keys set openrouter sk-or-XXXXXXXXXXXXXXXX --global
# or
agentik keys set openrouter sk-or-XXXXXXXXXXXXXXXX --local

Verify Setup

Windows (PowerShell)

agentik self-test
agentik models list --filter gpt --refresh   # optional

macOS/Linux

agentik self-test
agentik models list --filter gpt --refresh

Quick Start

  1. Initialize a project

PowerShell

mkdir my-agent; cd my-agent
agentik init . --template basic --name "My Agent Project"

macOS/Linux

mkdir my-agent && cd my-agent
agentik init . --template basic --name "My Agent Project"
  1. Scaffold an agent

PowerShell

agentik new agent research `
  --template basic `
  --tools http_fetch,html_to_text,write_file `
  --with-tests `
  --to .

macOS/Linux

agentik new agent research \
  --template basic \
  --tools http_fetch,html_to_text,write_file \
  --with-tests \
  --to .
  1. Minimal config (save as agents/agent.yaml)
agent:
  name: ResearchBot
  goal: "Research and summarize information."
  loop:
    max_steps: 3
    reflect: true

llm:
  model: openai/gpt-4o-mini
  temperature: 0.3

memory:
  type: json
  path: ./memory/research.json

policies:
  allow_network: true
  allow_filesystem: true

tools:
  - http_fetch
  - html_to_text
  - write_file
  1. Run your agent

PowerShell

agentik run .\agents\agent.yaml `
  -p "Summarize the main differences between GPT-4o and small LLMs in 5 bullets." `
  --profile fast `
  --stream `
  --save-transcript .\runs\first-run.jsonl

macOS/Linux

agentik run ./agents/agent.yaml \
  -p "Summarize the main differences between GPT-4o and small LLMs in 5 bullets." \
  --profile fast \
  --stream \
  --save-transcript ./runs/first-run.jsonl
  1. Use the dev watcher (auto re‑run on save)

PowerShell tip: quote your globs (e.g., '**/*.py') so the shell doesn’t expand them.

PowerShell

agentik dev watch .\agents\agent.yaml `
  --prompt "Summarize this project in 3 bullets." `
  --path . `
  --include '**/*.py' --include '**/*.yaml' --include 'templates/**' `
  --exclude '.venv/**' --exclude 'runs/**' `
  --save-transcripts .\runs `
  --profile dev `
  --stream

macOS/Linux

agentik dev watch ./agents/agent.yaml \
  --prompt "Summarize this project in 3 bullets." \
  --path . \
  --include '**/*.py' --include '**/*.yaml' --include 'templates/**' \
  --exclude '.venv/**' --exclude 'runs/**' \
  --save-transcripts ./runs \
  --profile dev \
  --stream

Configuration Primer

  • YAML config defines the agent (goal, loop), LLM (model, temperature), memory store, policies, and tools.

  • Profiles (CLI --profile) apply overrides:

    • fast: {max_steps=2, reflect=false, temperature=0.2}
    • thorough: {max_steps=6, reflect=true, temperature=0.3}
    • deterministic: {temperature=0.0, reflect=false}
    • creative: {temperature=0.9, reflect=false}
    • cheap: {temperature=0.2} (keeps configured model)
    • dev: {max_steps=3, reflect=false, temperature=0.3}
  • Precedence: YAML → RC/env → CLI overridesprofile overrides.


CLI Reference

Below, every command shows a signature and examples for Windows PowerShell and macOS/Linux.

Version & Environment

agentik version

Print CLI version.

PowerShell

agentik version

macOS/Linux

agentik version

agentik self-test

Show Python/OS info, OpenRouter key presence, and RC location.

PowerShell

agentik self-test

macOS/Linux

agentik self-test

Project Scaffolding

agentik init

agentik init [PATH] --template TEXT --force --name TEXT
  • PATH default .
  • --template default basic
  • --force overwrite existing files
  • --name project name override

PowerShell

agentik init . --template basic --name "Demo"

macOS/Linux

agentik init . --template basic --name "Demo"

agentik new agent

agentik new agent NAME \
  --template TEXT \
  --tools "t1,t2" \
  --memory [dict|json] \
  --memory-path PATH \
  --to DIR \
  --with-tests \
  --force

PowerShell

agentik new agent helper `
  --template basic `
  --tools http_fetch,html_to_text `
  --memory json `
  --memory-path .\memory\agent.json `
  --to . `
  --with-tests `
  --force

macOS/Linux

agentik new agent helper \
  --template basic \
  --tools http_fetch,html_to_text \
  --memory json \
  --memory-path ./memory/agent.json \
  --to . \
  --with-tests \
  --force

agentik new tool

agentik new tool NAME --template [python] --to DIR --with-tests --force

PowerShell

agentik new tool web_fetcher --template python --to . --with-tests --force

macOS/Linux

agentik new tool web_fetcher --template python --to . --with-tests --force

Templates

agentik template list

List built‑ins.

PowerShell

agentik template list

macOS/Linux

agentik template list

agentik template apply

agentik template apply kind/name --to DIR --force --name TEXT

PowerShell

agentik template apply agent/basic --to . --force --name MyBot

macOS/Linux

agentik template apply agent/basic --to . --force --name MyBot

agentik template pull

Pull a git repo or zip into templates/third_party.

PowerShell

agentik template pull https://example.com/my-templates.zip --to .

macOS/Linux

agentik template pull https://example.com/my-templates.zip --to .

Running Agents

agentik run

agentik run CONFIG \
  -p/--prompt TEXT \
  --model TEXT \
  --temperature FLOAT \
  --stream \
  --dry-run \
  --save-transcript PATH \
  --profile [fast|thorough|deterministic|creative|cheap|dev|none] \
  --tag TAG  (repeatable) \
  --note TEXT \
  --run-id TEXT \
  --obs-max-chars INT

PowerShell

agentik run .\agents\agent.yaml `
  -p "Five bullet summary of topic X" `
  --profile fast `
  --stream `
  --save-transcript .\runs\out.jsonl

macOS/Linux

agentik run ./agents/agent.yaml \
  -p "Five bullet summary of topic X" \
  --profile fast \
  --stream \
  --save-transcript ./runs/out.jsonl

Developer Watch Mode

agentik dev watch

agentik dev watch CONFIG \
  -p/--prompt TEXT \
  --prompt-file PATH \
  --path PATH          # repeatable; default "." \
  --include GLOB       # repeatable; default ["**/*.py", "**/*.yml", "**/*.yaml", "**/*.json", "**/*.md", "templates/**", "tools/**"] \
  --exclude GLOB       # repeatable \
  --interval FLOAT     # default 0.6 \
  --debounce FLOAT     # default 0.5 \
  --clear/--no-clear   # default clear \
  --stream/--no-stream # default stream \
  --profile dev        # default "dev" \
  --save-transcripts DIR \
  --obs-max-chars INT  # default 800 \
  --no-initial-run \
  --tag TAG            # repeatable; default ["dev"] \
  --note TEXT

PowerShell

agentik dev watch .\agents\agent.yaml `
  --prompt "Echo the date" `
  --include '**/*.py' `
  --exclude '.venv/**' `
  --save-transcripts .\runs

macOS/Linux

agentik dev watch ./agents/agent.yaml \
  --prompt "Echo the date" \
  --include '**/*.py' \
  --exclude '.venv/**' \
  --save-transcripts ./runs

Keys & Models

agentik keys set openrouter

Store an API key in RC.

PowerShell

agentik keys set openrouter sk-or-... --global
# or
agentik keys set openrouter sk-or-... --local

macOS/Linux

agentik keys set openrouter sk-or-... --global
# or
agentik keys set openrouter sk-or-... --local

agentik keys show

Display masked key (env & RC) and RC scope/path.

PowerShell

agentik keys show

macOS/Linux

agentik keys show

agentik models list

List OpenRouter models (with optional cache bypass).

PowerShell

agentik models list --filter gpt --refresh

macOS/Linux

agentik models list --filter gpt --refresh

Tools (Discovery & Direct Runs)

agentik tools list

List discoverable tools.

PowerShell

agentik tools list

macOS/Linux

agentik tools list

agentik tools info NAME

Show class & description.

PowerShell

agentik tools info http_fetch

macOS/Linux

agentik tools info http_fetch

agentik tools run NAME

Call a tool directly (no agent loop). Values auto‑coerce: true/false → bool; 1→int; 1.2→float; else string. Quote values with spaces/HTML.

PowerShell

agentik tools run http_fetch --arg url=https://example.com --arg ttl=3600 --arg allow_network=true --json
agentik tools run html_to_text --arg "html=<p>Hello</p>" --arg keep_newlines=true --json
agentik tools run write_file --arg path=out\hello.txt --arg "content=Hello" --arg allow_filesystem=true --json

macOS/Linux

agentik tools run http_fetch --arg url=https://example.com --arg ttl=3600 --arg allow_network=true --json
agentik tools run html_to_text --arg 'html=<p>Hello</p>' --arg keep_newlines=true --json
agentik tools run write_file --arg path=out/hello.txt --arg 'content=Hello' --arg allow_filesystem=true --json

Validation & Batch

agentik validate file

Validate YAML; optionally print effective config after CLI overrides.

PowerShell

agentik validate file .\agents\agent.yaml `
  --show-effective `
  --model openai/gpt-4o-mini `
  --temperature 0.2 `
  --max-steps 2

macOS/Linux

agentik validate file ./agents/agent.yaml \
  --show-effective \
  --model openai/gpt-4o-mini \
  --temperature 0.2 \
  --max-steps 2

agentik batch run

Run prompts from CSV/JSONL and write JSONL results.

PowerShell

agentik batch run .\prompts.jsonl `
  --column prompt `
  --out .\results.jsonl `
  --model openai/gpt-4o-mini `
  --temperature 0.2

macOS/Linux

agentik batch run ./prompts.jsonl \
  --column prompt \
  --out ./results.jsonl \
  --model openai/gpt-4o-mini \
  --temperature 0.2

Memory Helpers

agentik memory init

Initialize store and add an initial record.

PowerShell

agentik memory init --type json --path .\memory\agentik.json

macOS/Linux

agentik memory init --type json --path ./memory/agentik.json

agentik memory recall

PowerShell

agentik memory recall --n 10 --config .\agents\agent.yaml

macOS/Linux

agentik memory recall --n 10 --config ./agents/agent.yaml

agentik memory summarize

PowerShell

agentik memory summarize --n 20 --max-chars 1200 --config .\agents\agent.yaml

macOS/Linux

agentik memory summarize --n 20 --max-chars 1200 --config ./agents/agent.yaml

agentik memory clear

PowerShell

agentik memory clear --config .\agents\agent.yaml

macOS/Linux

agentik memory clear --config ./agents/agent.yaml

agentik memory path

PowerShell

agentik memory path --config .\agents\agent.yaml

macOS/Linux

agentik memory path --config ./agents/agent.yaml

Lightweight Eval Harness

agentik eval run

Each JSONL line should have prompt, and optional expect_contains[] and/or expect_regex.

PowerShell

agentik eval run .\tests.jsonl --config .\agents\agent.yaml --out .\eval_results.jsonl

macOS/Linux

agentik eval run ./tests.jsonl --config ./agents/agent.yaml --out ./eval_results.jsonl

Config Helpers

agentik config path

Show the .agentikrc path for a scope.

PowerShell

agentik config path --global
agentik config path --local

macOS/Linux

agentik config path --global
agentik config path --local

Built‑in Tools & Policies

Selected built‑ins:

  • http_fetch(url, ttl, timeout, max_bytes, headers, allow_network){ok, data, error, meta} (data.text, data.status, cache info)
  • html_to_text(html, keep_newlines, drop_links, max_chars) → plaintext
  • write_file(path, content, encoding, overwrite, allow_abs, allow_filesystem) → safe file writer

Policies are enforced by config:

policies:
  allow_network: true | false
  allow_filesystem: true | false

If a tool requires a disabled capability, the call is blocked and recorded in observations/transcripts.


Transcripts & Cost Estimation

Add --save-transcript PATH (single run) or --save-transcripts DIR (dev watch) to write JSONL transcripts. Summaries include steps, token counts, timings, and cost if available.

Optional pricing overrides (USD / 1K tokens):

PowerShell

$env:AGENTIK_PRICE_PROMPT_PER_1K = "0.50"
$env:AGENTIK_PRICE_COMPLETION_PER_1K = "1.50"

macOS/Linux

export AGENTIK_PRICE_PROMPT_PER_1K="0.50"
export AGENTIK_PRICE_COMPLETION_PER_1K="1.50"

Quick Reference Table

Area Command Key Options
Version agentik version
Self‑test agentik self-test
Init agentik init [PATH] --template, --force, --name
Run agentik run CONFIG -p, --model, --temperature, --stream, --dry-run, --save-transcript, --profile, --tag, --note, --run-id, --obs-max-chars
Keys agentik keys set openrouter --global or --local
Keys agentik keys show
Models agentik models list --filter, --refresh
New agentik new agent NAME --template, --tools, --memory, --memory-path, --to, --with-tests, --force
New agentik new tool NAME --template, --to, --with-tests, --force
Templates agentik template list/apply/pull as above
Tools agentik tools list/info/run --arg, --json
Validate agentik validate file CONFIG --show-effective, --model, --temperature, --max-steps
Batch agentik batch run FILE --column, --out, --model, --temperature
Memory agentik memory {init recall summarize clear path} see above
Eval agentik eval run FILE.jsonl --config, --out
Dev agentik dev watch CONFIG -p/--prompt-file, --path, --include, --exclude, --interval, --debounce, --clear, --stream, --profile, --save-transcripts, --obs-max-chars, --no-initial-run, --tag, --note
Config agentik config path --global or --local

You’re set. Keep this open while you iterate; pair it with agentik dev watch for the fastest edit‑run loop.


Troubleshooting

  • “Network error talking to OpenRouter.” Confirm your key in the current shell:

    • PowerShell: echo $env:OPENROUTER_API_KEY
    • macOS/Linux: echo $OPENROUTER_API_KEY Then try: agentik models list --refresh. Behind a proxy? Set HTTP_PROXY/HTTPS_PROXY.
  • Dev watcher: “unexpected extra arguments …”

    • Quote globs in PowerShell: --include '**/*.py' (single quotes).
  • Auth error / missing key: set OPENROUTER_API_KEY or run agentik keys set openrouter ....

  • Rate limited: add delays, batch, or upgrade your OpenRouter plan.

  • Network error: check connectivity or proxy settings (HTTP_PROXY, HTTPS_PROXY).

  • PowerShell globbing: quote globs, e.g. --include '**/*.py'.


Development

  • Lint/format: ruff check . and black .
  • Tests: pytest -q

Happy building with Agentik!

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

agentik_framework-1.1.4.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

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

agentik_framework-1.1.4-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file agentik_framework-1.1.4.tar.gz.

File metadata

  • Download URL: agentik_framework-1.1.4.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for agentik_framework-1.1.4.tar.gz
Algorithm Hash digest
SHA256 8a55e10903260ffd42e911f4a649c6b47991fda9415d3e560209547ed842b122
MD5 2650df4c3c86961de8e362dd8cb1923e
BLAKE2b-256 9a0a7ef3427a0f264bc7e1b89819f1d7051b004316117e380b22f74cc8ec51c5

See more details on using hashes here.

File details

Details for the file agentik_framework-1.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for agentik_framework-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 82208c1d5eb573a2e26b96261126b2433d4dfe1d4ccb204a07fbd115c8928286
MD5 1c8cc258645e939595efde21d246a4a8
BLAKE2b-256 ac71a567a4d5196c0bda42b11588dcf1abe0db62833523e58d266c15f6c01fb5

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