A lightweight, layered Agent framework for Python
Kora is a lightweight Python framework for building AI agents. Use it as a Python SDK to integrate agents into your applications, or launch the Kora Code CLI for an interactive AI coding partner.
from kora import Agent, tool
from kora.providers import get_provider_registry
@tool
def calculate(expression: str) -> str:
"""Evaluate a math expression."""
return str(eval(expression, {"__builtins__": {}}, {}))
model = get_provider_registry().get_model("deepseek", "deepseek-v4-flash")
agent = Agent(name="assistant", tools=[calculate], model=model)
result = agent.run_sync("What is 3 + 5?")
print(result) # The model calls calculate(3+5) and responds with the answer
Installation
# Kora SDK — integrate agents into your Python applications
pip install kora-agent
# Kora Code — interactive AI coding assistant (CLI)
pip install kora-agent kora-code
Requires Python 3.12+. Zero required runtime dependencies.
Features
- Minimal API.
Agent,Session,@tool, and you're done. - 26 built-in model providers. OpenAI, Anthropic, DeepSeek, DashScope, and more — one registry, one API.
- 8 core tools out of the box. Filesystem, shell, Python sandbox, and user interaction — all workspace-scoped.
- Security by code, not by prompt. SSRF protection, command filtering, import restrictions, and workspace isolation are enforced in implementation.
- Observable by default. Every run emits structured events (
RunStarted,ToolExecuted,RunCompleted, ...) for streaming and debugging.
Quick Start
SDK — Build agents in Python
from kora import Agent, tool
from kora.providers import get_provider_registry
from kora.tools import get_core_tools
import asyncio
@tool
def echo(message: str) -> str:
"""Echo back a message."""
return f"Echo: {message}"
model = get_provider_registry().get_model("deepseek", "deepseek-v4-flash")
agent = Agent(
name="assistant",
system_prompt="You are a helpful assistant.",
tools=[echo, *get_core_tools(".")],
model=model,
)
async def main():
session = agent.open_session()
result = await session.send("What files are in this directory?")
print(result)
asyncio.run(main())
📖 Kora Agent SDK Tutorials — 8 chapters covering agents, tools, providers, sessions, events, and more.
CLI — Launch an AI coding assistant
# Interactive REPL
kora code
# One-shot task
kora code "Refactor src/main.py to use async/await"
# Custom agent
kora run --agent /path/to/AGENT.md
📖 Kora Code CLI Tutorials — 5 chapters on commands, modes, customization, and best practices.
Documentation
| Resource | Description |
|---|---|
| Getting Started | Setup and your first agent |
| Tools Guide | All built-in tools with parameters |
| API Reference | Complete API reference |
| Examples | Runnable demo scripts |
| 📖 SDK Tutorials | Step-by-step Python SDK guide (8 chapters) |
| 📖 CLI Tutorials | Step-by-step Kora Code guide (5 chapters) |
| Architecture Decisions | ADR records for architectural boundaries |
| Current State | What is implemented today |
Model Providers
Kora ships with 26 built-in providers covering 300+ models. Set the corresponding environment variable and go:
| Provider ID | Example models | API key env |
|---|---|---|
openai |
gpt-4o, gpt-4-turbo, gpt-3.5-turbo |
OPENAI_API_KEY |
anthropic |
claude-3-5-sonnet-20241022, claude-3-opus-20240229 |
ANTHROPIC_API_KEY |
agnes |
agnes-2.0-flash |
AGNES_API_KEY |
dashscope |
qwen-max, qwen-plus, qwen-turbo |
DASHSCOPE_API_KEY |
jdcloud |
glm-5, glm-4 |
JDCLOUD_API_KEY |
deepseek |
deepseek-chat, deepseek-reasoner, deepseek-v4-flash |
DEEPSEEK_API_KEY |
deepseek-anthropic |
deepseek-v4-flash, deepseek-v4-pro (via Anthropic API) |
DEEPSEEK_API_KEY |
moonshot |
moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
MOONSHOT_API_KEY |
openrouter |
anthropic/claude-3.5-sonnet, openai/gpt-4o |
OPENROUTER_API_KEY |
ollama |
llama3, mistral, qwen2 |
local (no key) |
Custom provider? Register one in 5 lines:
from kora.providers import ProviderSpec, ModelSpec, get_provider_registry
registry = get_provider_registry()
registry.register(ProviderSpec(
id="my-provider", name="My Provider",
base_url="https://api.example.com/v1", api="openai-completions",
api_key="${MY_API_KEY}",
models=(ModelSpec(id="my-model", name="My Model", tool_calling=True),),
))
Built-in Tools
Use get_core_tools(workspace) to get the 8 essential tools for a coding agent:
| Tool | Capability |
|---|---|
list_files |
Browse directories (ls, find, tree) |
search_text |
Search file contents (grep, rg) |
read_file |
View files with line ranges (cat, head, tail) |
write_file |
Create or overwrite files |
apply_patch |
Apply targeted text patches |
run_shell |
Execute shell commands (filtered) |
execute_python |
Run Python in a sandbox |
request_interaction |
Ask the user for input |
Architecture
Interface → Host → Runtime → Kernel
| Layer | Responsibility |
|---|---|
| Kernel | Synchronous model-tool loop. No knowledge of agents, sessions, or users. |
| Runtime | Async Agent/Session/Run lifecycle. Event emission, context management. |
| Host | Persistence, identity, permissions, instruction composition. |
Each layer depends only on the layer inside it. The Kernel is fully testable with fake models — no network required.
Contributing
Kora is intentionally small. Before making a change, read CLAUDE.md and the ADR records.
- Identify which architectural layer owns the change.
- Prefer the smallest complete change; add tests with behavior changes.
- Do not cross established layer boundaries.
pip install -e ".[dev]" # editable install with dev tooling
pytest # run tests
ruff check src/kora # lint
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kora_agent-0.1.7.2.tar.gz.
File metadata
- Download URL: kora_agent-0.1.7.2.tar.gz
- Upload date:
- Size: 122.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58c60e289bb26c9262be47e874128b968f665bbfc154a043bd1377d3664bb3d2
|
|
| MD5 |
b263e1abb54856e8bd63b00b9f09ea88
|
|
| BLAKE2b-256 |
99e02047c7abc93bc5b246ebf96600a498084046574c25dbeb6f02c9e3d0f04e
|
Provenance
The following attestation bundles were made for kora_agent-0.1.7.2.tar.gz:
Publisher:
publish.yml on xvshiting/kora
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kora_agent-0.1.7.2.tar.gz -
Subject digest:
58c60e289bb26c9262be47e874128b968f665bbfc154a043bd1377d3664bb3d2 - Sigstore transparency entry: 1964667104
- Sigstore integration time:
-
Permalink:
xvshiting/kora@bd0be2bdb4088089c400f064fee6bff4d97333c3 -
Branch / Tag:
refs/tags/kora-agent-v0.1.7.2 - Owner: https://github.com/xvshiting
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bd0be2bdb4088089c400f064fee6bff4d97333c3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kora_agent-0.1.7.2-py3-none-any.whl.
File metadata
- Download URL: kora_agent-0.1.7.2-py3-none-any.whl
- Upload date:
- Size: 175.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62d2ab3820509fc8c997ad0ca09917ba5563df33b123d6a1b2d36820b96c51aa
|
|
| MD5 |
1dcac1d4abcfa6188a7ad7648cbc125b
|
|
| BLAKE2b-256 |
167e1da9f0248c851e89e932d4dd7e5d3357b205d9b74b65f25b6c3526048cad
|
Provenance
The following attestation bundles were made for kora_agent-0.1.7.2-py3-none-any.whl:
Publisher:
publish.yml on xvshiting/kora
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kora_agent-0.1.7.2-py3-none-any.whl -
Subject digest:
62d2ab3820509fc8c997ad0ca09917ba5563df33b123d6a1b2d36820b96c51aa - Sigstore transparency entry: 1964667190
- Sigstore integration time:
-
Permalink:
xvshiting/kora@bd0be2bdb4088089c400f064fee6bff4d97333c3 -
Branch / Tag:
refs/tags/kora-agent-v0.1.7.2 - Owner: https://github.com/xvshiting
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bd0be2bdb4088089c400f064fee6bff4d97333c3 -
Trigger Event:
push
-
Statement type: