Skip to main content

low level agent sdk

Project description

Tokki

Tokki is a protocol and library I designed to make it easier to create and design agents. Most other frameworks express agents as configuration, but I often find myself wanting to express agents as code where I can control every part of the loop.

Features

  • Async gRPC service for Tokki agents
  • Protobuf types exported from tokki_sdk
  • LLM vendor adapters for Kimi, Mistral, Anthropic, and Ollama
  • Tool runtime with file, shell, grep, glob, memory, database, PDF, MCP, and agent-to-agent helper tools
  • SQLite-backed conversation archive
  • Optional workspace boundary enforcement for file tools

Installation

pip install tokki-sdk

For local development:

uv sync --group dev
uv run pytest
./typecheck

Optional extras:

pip install "tokki-sdk[pdf]"
pip install "tokki-sdk[langchain]"

Minimal Agent

from tokki_sdk import Agent, Context, Role, Status
from tokki_sdk.tokki_pb2 import ContentNode


class EchoAgent(Agent):
    async def init(self, context: Context) -> bool:
        context.upsert_message_from_input(
            role=Role.SYSTEM,
            content=[ContentNode(text="You are a concise assistant.")],
        )
        return True

    async def run(self, context: Context) -> None:
        context.update_status(Status.STREAMING)
        context.upsert_message_from_input(
            role=Role.ASSISTANT,
            content=[ContentNode(text="Hello from Tokki.")],
        )
        context.update_status(Status.COMPLETED)

Tool-Calling Agent

tokki_sdk.agents.toolcall.Toolcall implements a ReACT-style agent loop with LLM tool calls:

import os

from tokki_sdk.agents.toolcall import Toolcall
from tokki_sdk.vendor import Kimi


agent = Toolcall(
    model="moonshot-v1-auto",
    summarisation_model="moonshot-v1-8k",
    vendor=Kimi(api_key=os.environ["MOONSHOT_API_KEY"]),
)

The built-in tool-calling agent uses workspace/ as its working directory and enforces file path boundaries for file tools.

Security Model

Tokki SDK agents are meant to run in a sandboxed environment, unless you avoid bash tool and internet usage.

Workspace Pattern

Agents can use a workspace/ directory for command execution, temporary files, generated outputs, and conversation archives. See docs/WORKSPACE.md for details.

Development

Run tests:

uv run pytest

Run type checks:

./typecheck

Integration tests that call real LLM or MCP services are skipped unless the required environment variables are set.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokki_sdk-0.1.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

tokki_sdk-0.1.0-py3-none-any.whl (62.5 kB view details)

Uploaded Python 3

File details

Details for the file tokki_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: tokki_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tokki_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e71a79c80b695bebabc2e0d1c1aa5e8a0cc9caf172d02ffe95e55f10e2691fdb
MD5 95167eed7efa65caf8e106645953a7fe
BLAKE2b-256 d015691fa5b6c31fac38a3171f0b144c45daed9df1d9a0b11a8f006d7ef208c7

See more details on using hashes here.

File details

Details for the file tokki_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tokki_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 62.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tokki_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b60f17b7067e7ee1775dd7e163d26f86052aef498f104fc5536386d8d2af37a
MD5 a6a9bbedbaf4380a355746077da5b719
BLAKE2b-256 fcfce6bb8bebc35c82ec3f6b98312dc43d04dcb041ce9bbbab18daa43f14403d

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