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.1.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.1-py3-none-any.whl (168.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kora_agent-0.1.7.1.tar.gz
  • Upload date:
  • Size: 115.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kora_agent-0.1.7.1.tar.gz
Algorithm Hash digest
SHA256 e9c9fb2b0abc5d5c3644940ad5f3d3aec1702f38cb84b05e476b657d4b6e9faf
MD5 17107eeeba0069128791abdfa9a31c80
BLAKE2b-256 cf600bb9a01889c7af5f6e2e38dd5e2391c371caab901380324fe6396e8abd62

See more details on using hashes here.

Provenance

The following attestation bundles were made for kora_agent-0.1.7.1.tar.gz:

Publisher: publish.yml on xvshiting/kora

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: kora_agent-0.1.7.1-py3-none-any.whl
  • Upload date:
  • Size: 168.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kora_agent-0.1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4009c000045a145460e7255e325228b79820f7dc56846d0adaf19712b52b8a1b
MD5 4512d0741c7887917c0c95e9d2749bbf
BLAKE2b-256 f45e0cbf971a9b94229b07693ddaca2c8ce8c36d1e6a584c7d88f349b0bef81a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kora_agent-0.1.7.1-py3-none-any.whl:

Publisher: publish.yml on xvshiting/kora

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page