Skip to main content Switch to mobile version kage-ai 0.16.1 AI-native cron task runner for per-project scheduled prompts and commands.
pip install kage-ai==0.16.1 Copy PIP instructions
kage is an ultra-lightweight, OS-native execution layer for AI agents. By leveraging standard schedulers like cron and launchd, it runs official AI CLIs (antigravity, gemini, claude, codex, opencode, copilot, etc.) in headless mode with zero background overhead. You can install it on your work PC, define tasks in Markdown inside your project repository, and leave it running overnight. By morning, your AI agent has finished the work for you, delivering documented results while you were away.
Go to sleep. Wake up to results. — kage runs your AI agents overnight, so you start every morning with answers, not questions.
kage is built to be a thin, transparent, and resource-efficient execution layer.
OS Native: Does not run a persistent background daemon. It leverages cron (Linux) and launchd (macOS) to wake up, execute tasks, and exit. Zero memory footprint when idle.
Headless CLI Mode: Directly integrates with official AI CLIs (like antigravity, gemini, claude, opencode, copilot, etc.) in their standard mode. It doesn't rely on unofficial or unstable internal APIs.
Stateless & Transparent: Every execution is logged, and states are managed simply via SQLite and Markdown files.
Autonomous Agent Logic: Automatically decomposes tasks into GFM checklists and tracks progress.
Persistent Memory: Stores task state in .kage/memory/ to maintain context across runs.
Lightweight Execution: Leverages OS-native schedulers. Zero background overhead.
Flexible Execution: Supports AI prompt execution, shell commands, and custom scripts.
Compiled Task Overrides: kage compile
Advanced Workflow Controls: Execution Modes: continuous, once, autostop.
Concurrency Policy: allow, forbid (skip if running), replace (kill old).
Time Windows: Restrict execution using allowed_hours: "9-17" or denied_hours: "12".
Markdown-First: Define tasks using simple Markdown files with YAML front matter.
Layered Configuration: .kage/config.local.toml > .kage/config.toml > ~/.kage/config.toml > defaults.
Connectors: Integrate with Discord/Slack/Telegram. Task notifications are always enabled; bi-directional chat uses poll = true (1-minute polling) or realtime = true (immediate reception in Discord and Telegram) (⚠️ grants channel members AI access to your PC).
Thinking Process Isolation: AI workers automatically wrap reasoning in
Web Dashboard: Execution history, task management, and AI chat — all in one place.
Connector-aware runs export KAGE_ARTIFACT_DIR as a workspace-local staging directory (for example .kage/tmp/connector-artifacts/
Default built-in AI providers: codex, claude, gemini, antigravity, opencode, copilot, aider.
Use provider: antigravity to target Antigravity CLI. The built-in command template prefers the official agy binary and automatically falls back to antigravity when that is the executable name exposed on your PATH. For connector chat replies, kage uses a concise final-answer prompt and keeps Antigravity model arguments before --print so the user message is handled as the prompt instead of CLI session metadata.
Check out the Technical Architecture for more details.
curl -sSL https://raw.githubusercontent.com/igtm/kage/main/install.sh | bash The installer automatically runs pending install-time migrations after upgrading kage.
You can also add this repository's skills with:
npx skills add https://github.com/igtm/kage Quick Start
cd your-project kage init # Initialize kage in the current directory # Edit .kage/tasks/*.md to define your tasks kage ui # Open the web dashboard Shell Completion
Typer-based completion is enabled for kage.
# Recommended: explicit shell install kage completion install bash kage completion install zsh Preview or generate the script manually:
# bash kage completion show bash > ~/.kage-complete.bash echo 'source ~/.kage-complete.bash' >> ~/.bashrc # zsh kage completion show zsh > ~/.kage-complete.zsh echo 'source ~/.kage-complete.zsh' >> ~/.zshrc You can also use Typer's built-in option for current shell detection:
kage --install-completion Reload your shell after installation (exec $SHELL -l).
Shell completion also suggests task names and recent run IDs for positional arguments like kage run
🌙 Overnight Tech Evaluation (OCR Model Benchmark)
The killer use case: go to sleep, wake up with a complete technology evaluation report.
Create a single task that, on every cron run, picks the next untested OCR model, implements it, runs it against your test PDFs, and records the accuracy. By morning, you have a ranked comparison.
.kage/tasks/ocr_benchmark.md:
--- name: OCR Model Benchmark cron: "0 * * * *" provider: claude mode: autostop denied_hours: "9-23" working_dir: ../../benchmark --- # Task: PDF OCR Technology Evaluation You are conducting a systematic evaluation of free/open-source OCR solutions for extracting text from Japanese financial PDF documents. ## Target Models (test one per run) - Tesseract (jpn + jpn_vert) - EasyOCR - PaddleOCR - Surya OCR - DocTR (doctr) - manga-ocr (for vertical text) - Google Vision API (free tier) ## Instructions 1. Check `.kage/memory/` for which models have already been tested. 2. Pick the NEXT untested model from the list above. 3. Install it and write a test script in `benchmark/test_{model_name}.py`. 4. Run it against the PDF files in `benchmark/test_pdfs/`. 5. Measure: Character accuracy (CER), processing time, memory usage. 6. Save results to `benchmark/results/{model_name}.json`. 7. Update `benchmark/RANKING.md` with a comparison table of all tested models so far. 8. When all models are tested, set status to "Completed" in memory. working_dir is optional. Absolute paths are used as-is; relative paths are resolved from the task file directory (.kage/tasks/).
To pause a task without disabling it, use suspension metadata or the CLI:
suspended_until: "2026-05-09T18:30:00+09:00" suspended_reason: "Vacation for 2 weeks" kage task suspend
benchmark/ ├── RANKING.md ← Full comparison table, ready for decision ├── results/ │ ├── tesseract.json │ ├── easyocr.json │ ├── paddleocr.json │ └── ... └── test_pdfs/ ├── invoice_001.pdf └── report_002.pdf 🔍 Overnight Codebase Audit
.kage/tasks/audit.md:
--- name: Architecture Auditor cron: "0 2 * * *" provider: gemini mode: continuous denied_hours: "9-18" --- # Task: Nightly Architecture Health Check Analyze the codebase for: - Dead code and unused exports - Circular dependencies - API endpoints without tests - Security anti-patterns (hardcoded secrets, SQL injection risks) Write findings to `reports/audit_{date}.md`. 🧪 Overnight PoC Builder
.kage/tasks/poc_builder.md:
--- name: PoC Builder cron: "30 0 * * *" provider: claude mode: autostop denied_hours: "8-23" --- # Task: Build a Proof of Concept Read the spec in `specs/next_poc.md` and implement a working prototype. - Create the implementation in `poc/` directory - Include a README with setup instructions and demo commands - Write basic tests to verify core functionality - Set status to "Completed" when the PoC is functional ⚡ Simple Examples
AI Task — hourly health check:
--- name: Project Auditor cron: "0 * * * *" provider: gemini --- Analyze the current codebase for architectural drifts. The same task can use Antigravity CLI with:
--- name: Project Auditor cron: "0 * * * *" provider: antigravity --- Analyze the current codebase for architectural drifts. Shell-Command Task — nightly log cleanup:
--- name: Log Cleanup cron: "0 0 * * *" command: "rm -rf ./logs/*.log" shell: "bash" --- Cleanup old logs every midnight. Commands
Connectors integrate with external chat services (Discord, Slack, Telegram). Task notifications via notify_connectors are always enabled as long as credentials are configured.
kage exec -p "Explain this repository" runs synchronously in the current directory without creating a task file or registering a project. It uses the existing project-agent resolution (falling back to the default agent, then built-in kage) and provider settings. The answer goes to stdout; the run ID and diagnostics go to stderr. Runs and raw logs are available through kage runs and kage logs --run
For lengthy one-off work requested in connector chat, use kage dispatch --name
Outside a dispatch worker, detached work that finishes after its parent run must send its own completion message. The child process inherits KAGE_RUN_ID, KAGE_AGENT_NAME, and KAGE_ARTIFACT_DIR, so it can run:
kage connector send my_discord --message "Render complete" --file "$KAGE_ARTIFACT_DIR/output.mp4" Inside an agent run, the DB-anchored agent for KAGE_RUN_ID must match the connector's bound agent; cross-agent sends are rejected. Agent-run attachments are restricted to top-level files in that run's KAGE_ARTIFACT_DIR. A human shell without agent environment variables remains an administrative context and may send through any configured connector.
For bi-directional chat, choose one mode per connector:
poll = true — fetch messages every minute via cron/launchd. Telegram shows a typing indicator while generating a reply.
realtime = true — Discord listens on Gateway WebSocket; Telegram waits for updates via long polling. Both can start a reply and show typing as soon as a message arrives.
For Telegram realtime, set poll = false and use a bot token dedicated to that receiving connector. The bot must use a single update receiver and have its webhook disabled.
If you already have kage cron run in your crontab, realtime listeners are managed automatically: set realtime = true and the listener starts within one minute; remove it and the listener stops on the next cron tick. You can also manage them manually:
kage connector realtime start [name] # start detached listener(s) kage connector realtime stop [name] # stop listener(s) kage connector realtime restart [name] # restart listener(s) kage connector realtime status # show running listeners kage connector realtime run [name] # run in foreground for debugging Realtime logs are written to ~/.kage/logs/connector-realtime-
⚠️ Security Warning: poll = true or realtime = true allows anyone in the channel to interact with the AI, which has full access to your PC's file system and tools. Only enable one chat mode, and only in private/trusted channels.
Telegram replies include recent messages from the same chat and bound agent across polls. Use the connector’s history_limit to set the maximum number of previous messages.
Telegram conversation history includes delivered asynchronous dispatch replies, scoped to the originating chat and topic.
Telegram rich replies
The Telegram system prompt uses rich UI by default for substantive replies, such as a table for comparisons or buttons for choices. It places telegram-ui JSON fences between paragraphs. kage renders button rows, tables, quotes, and expandable details in the message. Buttons can open links, copy text, or send the visible label back as the next user input. A Mini App button opens an existing HTTPS web app inside a private Bot chat and becomes a link in other chats.
If Telegram rejects the rich message format, kage preserves the order using text and a standard inline keyboard. Reply buttons can be used once by their intended recipient and expire after seven days.
Telegram groups consecutive JPEG/PNG attachments into native photo albums of up to 10 images. To place images between paragraphs, the AI can output a collage or slideshow block using the filenames of outgoing artifacts. If Telegram rejects an inline layout, the photos are sent as an album or individual images.
Markdown headings, lists, emphasis, links and fenced code render as native rich blocks. If Telegram rejects a rich reply, ordinary messages still use Telegram formatting for emphasis, links and code. Use map with verified coordinates, math for LaTeX, and anchor with a Markdown fragment link for in-message references. A media block places an outgoing photo, MP4, GIF, audio, voice note or document in the reply. Galleries may also contain MP4 video.
Private chats support self-contained, touch-operated HTML messages with a widget block, and preview the user-facing reply as the provider emits it. Use checklist for a checklist. Set business_connection_id on the Telegram connector for native Business checklists. Without a Business connection, a private chat gets a checklist widget whose checks are stored on that device. Other chats get a text list when the Business format is unavailable.
Proactive conversation follow-up
kage can infer an interest from a recent conversation, finish the relevant research, and send useful developments back to the same chat. For example, if a vacuum cleaner you discussed drops into your price range, kage can compare it with a newer model before advising you.
Follow-up uses the same connector prompts as ordinary replies. The AI decides whether a verified development or newly found information is worth sharing now. kage can deliver that notice even if saving the research memo needs a retry. Telegram notices can use rich blocks such as tables and expandable details.
Follow-up is off by default. Add the following table to an existing connector to enable it for that connector's bound agent:
[connectors.my_telegram.follow_up] enabled = true Follow-up uses conversations received after opt-in. The existing kage cron run dispatches due research after six hours of user inactivity. Rechecks are spaced one, three, seven, fourteen, then thirty days apart, repeating every thirty days. Renewed interest restarts the cadence for that topic, and resolved topics close. Each connector can send at most one proactive message per twenty-four hours. Research appears in kage runs.
Isolated Linux agents
kage isolation tick
Agents & Multi-tenant Isolation
An Agent is a top-level concept that owns projects, connectors, memory, and a system prompt. The built-in agent kage always exists and cannot be removed; connectors and projects with no explicit agent fall back to it. Define your own agents to give connectors distinct personas and to prevent context from leaking between them — for example a private Discord channel can be bound to agent private while a public channel is bound to public, and conversations never cross over.
[agents.public] system_prompt = """ You are the public-facing assistant. Answer briefly and politely. Do not mention private projects or other agents. """ default_working_dir = "~/projects/public" [agents.private] system_prompt = "You are the user's private assistant. Be terse and direct." default_working_dir = "~/projects/private" [connectors.discord_public] type = "discord" poll = true bot_token = "..." channel_id = "..." agent = "public" # binds this connector to the public agent [connectors.discord_private] type = "discord" poll = true bot_token = "..." channel_id = "..." agent = "private" When kage spawns the AI provider, it injects two environment variables:
KAGE_RUN_ID — the authoritative execution id. The CLI looks up executions.agent_name in the SQLite database to decide which agent you run as. This column is protected by a SQLite trigger and cannot be updated or deleted.
KAGE_AGENT_NAME — display hint only. Tampering with it has no effect: the database always wins.
From inside the spawned shell, kage * commands are scoped to the agent. You cannot list, show, or operate on connectors, tasks, or memory bound to another agent. Human shells (no KAGE_RUN_ID set) act as superusers and bypass the scope filter — use kage doctor to see the warning if you accidentally left these set in your shell environment.
Each agent owns a topic-keyed memory space at ~/.kage/agents/
kage memory list # show available memories of the current agent kage memory show
macOS launchd Specific Settings
On macOS, kage uses launchd instead of cron. You can further customize its behavior in config.toml:
darwin_launchd_interval_seconds: Set the launch interval in seconds (minimum 15).
darwin_launchd_keep_alive: Set to true to keep the process running (not recommended for simple polling).
kage runs is the run-history view. By default it shows a compact table with relative timestamps like 4h ago; add --absolute-time to show detailed local timestamps again. kage logs is the raw-output viewer backed by per-run log files (stdout.log, stderr.log, events.jsonl). kage logs
If a prompt task has a sibling compiled lock such as .kage/tasks/nightly.lock.sh, kage executes that lock instead of the prompt body only while its stored prompt_hash still matches the current prompt body. When the prompt changes, the lock becomes stale and you need to run kage compile
kage task list shortens the project column to the leaf directory name, shows prompt tasks as Prompt or Prompt (Compiled), and resolves inherited providers as values like gemini (Inherited) so you can see what will actually run. Built-in codex runs now use codex exec --yolo ... in the default command template.
Suspension is separate from active: active: false disables a task, while suspended_until only blocks new starts until the deadline expires. Invalid suspended_until values fail closed, so the task is skipped until you fix the value or run kage task resume
Connector polling replies are recorded in the same run history. Use kage runs --source connector_poll to isolate them, then inspect the raw AI CLI output with kage logs --run
Install-time migrations are discovered automatically from src/kage/migrations/install/. New migration modules added there are picked up by both kage migrate install and install.sh.
kage tui provides a terminal dashboard powered by Textual. It has four tabs: Logs, Tasks, Connector, and Settings. The Logs tab filters runs and rendered logs from a task/run sidebar, the Tasks tab shows task details, the Connector tab shows connector history, and the Settings tab shows the global config snapshot.
Provider-specific model selection can be layered in the same files. You can set a single model or a fallback list with models:
[providers.codex] model = "gpt-5-codex" [providers.claude] models = ["claude-sonnet-4-5", "claude-haiku-4-5"] [providers.antigravity] model = "Gemini 3.5 Flash" [providers.opencode] models = ["openai/gpt-5-codex", "openai/gpt-5-mini"] When models is set, kage tries each model in order and falls back to the next one only when the previous hits a rate or usage limit. If all models fail, the run fails.
Built-in providers use --model by default. You can also set nested keys via CLI:
kage config default_ai_engine antigravity --global kage config providers.antigravity.model "Gemini 3.5 Flash" --global kage config providers.codex.model gpt-5-codex --global kage config providers.claude.models '["claude-sonnet-4-5","claude-haiku-4-5"]' --global kage config providers.codex.model gpt-5-mini --local License
Released: Dec 1, 2026
Release files for kage-ai 0.16.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 2.6 MB
Release files / kage_ai-0.16.1.tar.gz
Release files / kage_ai-0.16.1-py3-none-any.whl
Security for kage-ai 0.16.1
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 1, 2026 2 release files No provenance
Nov 30, 2026 2 release files No provenance
Nov 28, 2026 2 release files No provenance
Nov 5, 2026 2 release files No provenance
Sep 20, 2026 2 release files No provenance
Sep 19, 2026 2 release files No provenance
Jul 10, 2026 2 release files No provenance
Jul 8, 2026 2 release files No provenance
Jul 6, 2026 2 release files No provenance
Jul 5, 2026 2 release files No provenance
Jun 12, 2026 2 release files No provenance
Apr 25, 2026 2 release files No provenance
Apr 3, 2026 2 release files No provenance
Mar 29, 2026 2 release files No provenance
Mar 28, 2026 2 release files No provenance
Mar 15, 2026 2 release files No provenance
Mar 14, 2026 2 release files No provenance
Mar 8, 2026 2 release files No provenance
Mar 7, 2026 2 release files No provenance
Mar 4, 2026 2 release files No provenance
Mar 3, 2026 2 release files No provenance
Mar 2, 2026 2 release files No provenance
Mar 1, 2026 2 release files No provenance
Feb 28, 2026 2 release files No provenance
Feb 27, 2026 2 release files No provenance
Feb 25, 2026 2 release files No provenance
Feb 24, 2026 2 release files No provenance
Feb 23, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from a8e35ed











