Skip to main content

Kora

A lightweight, layered Agent framework for Python

Python License Status


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)

Full provider list →

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

Full tool reference →


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.

  1. Identify which architectural layer owns the change.
  2. Prefer the smallest complete change; add tests with behavior changes.
  3. 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

kora_agent-0.1.7.tar.gz (115.6 kB view details)

Uploaded Source

Built Distribution

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

kora_agent-0.1.7-py3-none-any.whl (168.3 kB view details)

Uploaded Python 3

File details

Details for the file kora_agent-0.1.7.tar.gz.

File metadata

  • Download URL: kora_agent-0.1.7.tar.gz
  • Upload date:
  • Size: 115.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kora_agent-0.1.7.tar.gz
Algorithm Hash digest
SHA256 c25e1e531ad811b1699b1cef3ac22399a7ef52258d39c19d0c9b5ca5d269a188
MD5 2e468809e36029d6b5645e5461dd95b7
BLAKE2b-256 836d5068caf653313ae6cb07398d7b99be567f1c29c8643920ed68b52d163d47

See more details on using hashes here.

File details

Details for the file kora_agent-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: kora_agent-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 168.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kora_agent-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0de85582ca8648d3279cbc64c25c846607f72714c9e59b8ebdaec4ff53f7c4e8
MD5 53febcd417d070e64e329a44192228b9
BLAKE2b-256 13b133d62c6a8579073297bed064c5bbf70722f139f940692ba5c277e8c6b3df

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 Sentry Error logging StatusPage Status page