Skip to main content

enki-py

enki-py is a Python package for building agents on top of Enki.

Install it from PyPI with pip:

pip install enki-py

Or add it to a project managed by uv:

uv add enki-py

It exposes two layers:

  • A generated low-level API built around EnkiAgent, EnkiTool, and EnkiToolHandler
  • A higher-level Python wrapper in enki_py.agent that adds decorator-based tools, dependency injection, and sync helpers

What to use

Use the high-level Agent wrapper when you want Python ergonomics.

For synchronous scripts, use run_sync():

from enki_py import Agent

agent = Agent(
"ollama::qwen3.5:latest",
instructions="Answer clearly and keep responses short.",
)

result = agent.run_sync("Explain what this project does.")
print(result.output)

For async applications, use await agent.run(...):

from enki_py import Agent

agent = Agent(
"ollama::qwen3.5:latest",
instructions="Answer clearly and keep responses short.",
)


async def hello_enki():
result = await agent.run("Explain what this project does.")
print(result.output)


if __name__ == "__main__":
import asyncio

asyncio.run(hello_enki())

Use the generated low-level API when you need exact control over tool specs and the tool handler callback:

import enki_py

agent = enki_py.EnkiAgent(
name="Minimal Agent",
system_prompt_preamble="You are concise.",
model="ollama::qwen3.5:latest",
max_iterations=4,
workspace_home=None,
)

In this documentation