ankaloop
Health Pass
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 33 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Out-of-the-box coding-agent runtime for terminal, IDE, server, and Telegram: built-in tools, subagents, skills, memory, MCP/ACP, hooks, and automation.
AnkaLoop
AnkaLoop is built for developers who want a useful agent immediately, not a framework they must
## Why AnkaLoop
python -m pip install ankaloop
A batteries-included, self-hostable, persistent coding-agent runtime
anka init
anka
AnkaLoop is built for developers who want a useful agent immediately, not a framework they must
assemble first. It ships with file editing, shell execution, web access, memory, skills,
anka --once "summarize this repository and suggest the next test to run"
automation as first-class capabilities.
The package is named uvx ankaloop init Requires Python 3.11+ and credentials for a supported model provider (or an The package is named AnkaLoop supports a Primary/Subagent architecture with built-in agent types: Primary agents can delegate to subagents for complex tasks. Use Skills are reusable knowledge or behavior definitions (markdown with YAML frontmatter) that inject specialized capabilities into the agent's system prompt. See docs/skills-and-commands.md for full documentation. Built-in skills: Discovery locations (increasing precedence): Skills support scheduled (cron) and event-based auto-triggers for autonomous execution. Hot reload is enabled when running the HTTP server. Custom command shortcuts defined as TOML files, invoked with Discovery locations: See docs/skills-and-commands.md for details and examples/commands/ for samples. AnkaLoop can run as an HTTP/WebSocket server for remote access: API endpoints (visit API authentication uses one configured API key, sent as Authenticated CLI clients can pass The default Docker command starts the server on loopback — safe without authentication: To expose the server on the host network, provide an API key via environment variables: Alternatively, mount a The health check ( AnkaLoop stores a bounded per-session timeline beside each session snapshot. It records turn, tool, AnkaLoop provides a Telegram Bot interface for remote interaction with agents. Install with Features: Configure via AnkaLoop maintains persistent cross-session context using complementary memory layers: Memory is stored at: The AnkaLoop provides a flexible hooks system to extend and customize agent behavior. Hooks can: Create See docs/hooks.md for full documentation. The CLI loads configuration from Telegram can switch configured providers without calling the LLM: Anthropic Claude: Anthropic support is included in the base Configured MCP servers are exposed as For a non-loopback host, set Deploy AnkaLoop on GMI Cloud. The Telegram runtime also supports group-specific and topic-specific policy overrides under CI runs Ruff and the non- See CONTRIBUTING.md for detailed development guidelines. Apache-2.0ankaloop. It installs the recommended anka command and theankaloop command. For a no-install run, use uvx ankaloop.
uvx ankaloop
pip install ankaloop
cron/systemd/Kubernetes jobs. Each surface supports persistent sessions; session discovery and
management are not yet identical across every surface.
pip install ankaloop[telegram]
compaction, progress events, and cancellation support make long-running work easier to trust.
specs without giving up the built-in experience.30-second start
OpenAI-compatible endpoint). init writes the provider configuration to~/.config/amcp/config.toml.# Install the PyPI package
python -m pip install ankaloop
# Configure your model provider, then start in the current project
anka init
anka
# Or run a single task
anka --once "summarize this repository and suggest the next test to run"
ankaloop. It installs the recommended anka command and theankaloop command. For a no-install run, use uvx ankaloop.What you get
Area
Built-in capabilities
Coding loop
read_file, grep, apply_patch, write_file, bash, think, todo, task
Research
Web search/fetch tools plus MCP server integration over stdio or HTTP/SSE
Agent orchestration
Primary/subagent architecture with
coder, explorer, planner, and focused_coder types
Context & memory
Persistent sessions, AGENTS.md rules, smart compaction, progressive loading, searchable memory and session history
Interfaces
CLI, FastAPI HTTP/WebSocket server, Telegram bot
Customization
TOML config, YAML agent specs, slash commands, reusable skills, hooks, event bus
Model support
OpenAI Chat Completions, OpenAI Responses API, Anthropic Claude, and OpenAI-compatible endpoints
Installation
Quick Run with uvx (no install needed)
# Initialize config first (model and runtime settings)
uvx ankaloop init
# Run the agent
uvx ankaloop
From PyPI
pip install ankaloop
# With Telegram bot support
pip install ankaloop[telegram]
From Source (development)
git clone https://github.com/tao12345666333/ankaloop.git
cd anka
# Using uv (recommended); includes dependencies needed by the full test suite
uv sync --extra dev --extra telegram
source .venv/bin/activate
# Or with pip in an activated virtual environment
python -m venv .venv && source .venv/bin/activate
python -m pip install -e ".[dev,telegram]"
Usage
# Initialize config
anka init # interactive wizard
anka init --quick # default config without prompts
# Agent chat (default command)
anka # interactive mode with conversation history
anka --once "create a hello.py file" # single message
anka -t explorer --once "find all TODOs" # use built-in agent type
anka --agent path/to/agent.yaml # use custom agent spec
anka --session my-session # use specific session ID
anka --clear # clear conversation history
anka --list # list available agent specifications
anka --list-types # list built-in agent types
anka --list-sessions # list saved sessions
# MCP server management
anka mcp tools --server custom
anka mcp call --server custom --tool example_tool --args '{"query":"rust async"}'
# HTTP/WebSocket server
anka serve # start on localhost:8080
anka serve --port 8080 --host 0.0.0.0 # requires [server.auth] configuration
anka serve --telegram # start Telegram bot alongside
anka attach http://localhost:8080 # connect to a running server
anka attach https://server.example --api-key "$ANKA_SERVER_API_KEY"
# Telegram bot
anka telegram start # start polling
anka telegram status # show config status
anka telegram setup # interactive setup
Built-in Tools
Tool
Description
read_file
Read text files with slice mode (line ranges) or indentation mode (anchor-based context)
grep
Search for patterns in files using ripgrep
bash
Execute shell commands from the request working directory; large output is truncated
think
Internal reasoning and planning
todo
Manage a todo list to track tasks during complex operations
apply_patch
Apply diff-based patches to files (see docs/apply-patch.md)
write_file
Write content to files (for creating new small files)
task
Spawn sub-agents for parallel task execution
web_search
Search the web for information without configuring a search API key
web_fetch
Fetch and extract content from web pages without configuring a search API key
memory
Store and retrieve persistent cross-session memories
session_search
Search persisted conversation history across sessions
Multi-Agent System
Agent Type
Mode
Description
coder
Primary
Full-capability coding agent with write access
explorer
Subagent
Read-only fast codebase exploration
planner
Subagent
Read-only planning and analysis
focused_coder
Subagent
Focused implementation of specific changes
-t <type> to select an agent type.Skills System
skill-creator - Generate new skills interactivelysession-cleanup - Clean up old session filesheartbeat - Periodic health check and status reportingnetworked-research - Multi-source web research with synthesistelegram-sender - Send messages via Telegram
~/.config/amcp/skills/<name>/SKILL.md~/.agents/skills/<name>/SKILL.md.amcp/skills/<name>/SKILL.mdSlash Commands
/command syntax. Features include:
{{args}} placeholder for command arguments!{shell command} for shell output injection (auto-escaped args)@{file path} for file content injectiongit/commit.toml -> /git:commit)
~/.config/amcp/commands/*.toml.amcp/commands/*.toml (takes precedence)HTTP/WebSocket Server
anka serve # start on localhost:8080
anka serve --port 8080 # custom port
anka serve -w /path/to/project # set working directory
anka attach http://localhost:8080 # connect from another terminal
/docs for interactive Swagger UI):
GET /api/v1/health - health checkPOST /api/v1/sessions - create sessionsPOST /api/v1/sessions/{id}/prompt - submit a prompt and return request statusPOST /api/v1/sessions/{id}/prompt/stream - submit a prompt and stream JSON-line eventsGET /api/v1/sessions/{id}/turns/{turn_id} - query queued, running, or retained terminal turn statePOST /api/v1/sessions/{id}/cancel - cancel current session workGET /api/v1/sessions/{id}/timeline - read durable metadata-only execution eventsDELETE /api/v1/sessions/{id} - delete a sessionGET /api/v1/tools - list available toolsGET /api/v1/agents - list agent typesWS /ws - WebSocket for live eventsServer authentication
Authorization: Bearer <api-key>.
Unauthenticated operation is permitted only when the server binds to a loopback address. A
non-loopback bind (for example 0.0.0.0) requires authentication; configure an API key before
exposing the service. This is transport authentication, so use TLS or a trusted reverse proxy for
traffic that leaves the machine.--api-key or set ANKA_SERVER_API_KEY. HTTP clients sendAuthorization: Bearer <api-key>; WebSocket clients may use the same header. The health endpoint
remains public for probes.Docker
docker build -t ankaloop .
docker run -it ankaloop serve # loopback:8080, no auth needed
docker run -p 8080:8080 \
-e ANKA_HOST=0.0.0.0 -e ANKA_API_KEY=your-secret \
ankaloop serve
config.toml with [server.auth] enabled:docker run -p 8080:8080 -v ./config.toml:/root/.config/amcp/config.toml \
ankaloop serve --host 0.0.0.0
GET /api/v1/health) always remains public for container orchestration probes.
For interactive CLI usage inside a container without starting the server:docker run -it ankaloop --once "explain this codebase"
Durable execution timeline
subagent task, context-compaction, provider retry/error, and token-usage metadata so interrupted
sessions remain inspectable. Prompt content, tool arguments, tool output, and raw
provider exception text are deliberately excluded. The newest 2,000 events are retained by
default and can be queried with GET /api/v1/sessions/{id}/timeline.Telegram Integration
pip install ankaloop[telegram].
/new, /session list, /session switch <id>, /clear, and /cancel/new creates a fresh session and abandons the previous Telegram session's active work and queued messagesanka telegram setup or in config.toml under [telegram].Memory System
~/.config/amcp/memory/.amcp/memory/ (project-specific knowledge)~/.config/amcp/SOUL.md and ~/.config/amcp/IDENTITY.mdmemory tool manages durable knowledge, while session_search searches persisted
conversation history. User and project memory are merged for context; persona files remain
global so the agent keeps one identity across interfaces and projects.Hooks System
.amcp/hooks.toml in your project:[hooks.PreToolUse]
[[hooks.PreToolUse.handlers]]
matcher = "write_file|apply_patch"
type = "python"
script = "./scripts/validate-writes.py"
timeout = 30
[[hooks.PostToolUse.handlers]]
matcher = "*"
type = "command"
command = "echo 'Tool executed' >> /tmp/tool_log.txt"
Config
~/.config/amcp/config.toml. Generate a starter config:anka init
Chat Configuration
[chat]
active_provider = "primary" # optional: selected [chat.providers.<name>] profile
request_timeout_seconds = 120
max_retries = 2 # transient connection, timeout, 429, and 5xx failures only
retry_base_delay_seconds = 0.5 # exponential backoff with jitter
mcp_tools_enabled = true
write_tool_enabled = true
edit_tool_enabled = true
tool_loop_limit = 300
bash_tool_limit = 100
default_max_lines = 400
read_roots = ["."] # optional: restrict read_file to these roots
default_agent = "coder" # optional: coder, explorer, planner, focused_coder
max_queue_size = 100
[chat.providers.primary]
api_type = "openai"
base_url = "https://example.com/v1"
model = "provider/model-name"
[chat.providers.backup]
api_type = "anthropic"
model = "claude-model-name"
/models lists configured provider profiles./model use backup switches active_provider and persists it to config.toml (admin only).[chat]
api_type = "anthropic"
model = "claude-model-name"
ankaloop package; no separate extra is required.MCP Servers
# HTTP/SSE transport
[servers.custom]
url = "https://example.com/mcp"
# stdio transport
[servers.local]
command = "npx"
args = ["-y", "@some/mcp-server"]
mcp__<server>__<tool> tools. Server and
tool names are sanitized into [A-Za-z][A-Za-z0-9_-]*, because some providers
(for example Kimi/Moonshot) reject any other function name with HTTP 400. The
built-in web_search and web_fetch tools are available separately and work
out of the box without adding a search MCP server.Context Optimization
[context]
progressive_tools = true # dynamically load tools based on relevance
progressive_skills = true # dynamically load skills based on relevance
response_ratio = 0.30 # reserve 30% of context for response
Server Configuration
[server]
host = "127.0.0.1"
port = 8080
[server.auth]
enabled = false # valid without a key only for loopback binds
# api_key = "replace-with-a-secret"
enabled = true and api_key, then send the key as a Bearer token.Provider and deployment options
New GMI Cloud users can optionally sign up with the maintainer's
referral link (a referral, not a requirement).Telegram Configuration
[telegram]
enabled = false
allowed_users = [123456789]
admin_users = [123456789]
dm_policy = "allowlist" # "allowlist", "pairing", "open", "disabled"
group_policy = "mention" # "mention", "open", "allowlist", "disabled"
max_queue_size = 20
typing_indicator = true
[telegram.pairing]
enabled = true
code_ttl_seconds = 1800
[telegram.groups."<chat_id>"] and [telegram.groups."<chat_id>".topics."<topic_id>"].Development
Setup
uv sync --extra dev --extra telegram
source .venv/bin/activate
uv tool install pre-commit
pre-commit install
# Or use pip in an activated virtual environment
python -m pip install -e ".[dev,telegram]"
python -m pip install pre-commit
pre-commit install
Running Tests
make test # run all tests
make test-cov # run with coverage
python -m pytest -q -m "not llm" # CI-equivalent suite without live provider calls
python -m pytest tests/test_tools.py -v # specific test
Code Quality
make lint # ruff check
make format # ruff format
make type-check # mypy
llm test suite on Python 3.11, 3.12, and 3.13. Tests marked llm
call live model providers and require credentials.Notes
rg (ripgrep) must be installed and on PATH for the grep tool.
timeout, rate-limit, and server errors with bounded exponential backoff. Authentication,
invalid-request, protocol, and streaming failures after output has started are not retried.
Compaction and memory-maintenance model calls currently retain their existing provider behavior.bash limits, output truncation for bash, and
per-conversation plus per-session read_file limits.License
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found