Skip to main content

A minimalist library with as few dependencies as possible.

Project description

Kiori

A minimalist Python agent library with as few dependencies as possible.

Installation

# Basic installation
pip install kiori

# Installation with memory support
pip install "kiori[memory]"

Quick Start

from kiori.agent import KioriAgent
from kiori.models import Action, ActionExample

# Initialize agent
agent = KioriAgent()

# Define an action
def my_func():
    return "Action executed!"

action = Action(
    name="my_action",
    description="Does something cool",
    function_callable=my_func
)
agent.add_action(action)

# Add an example
example = ActionExample(
    user_prompt="Do something cool",
    expected_action_text="my_action()"
)
agent.add_example(example)

# Run agent
agent.run("Do something cool")

Memory (LTM & STM)

Kiori provides memory modules for both Long-Term Memory (LTM) and Short-Term Memory (STM).

Long-Term Memory (MilvusLTM)

Kiori provides a MilvusLTM class using Milvus Lite.

from kiori.memory import MilvusLTM
from kiori.models import ActionExample

# Initialize memory (auto-creates local Milvus Lite DB)
ltm = MilvusLTM()

example = ActionExample(
    user_prompt="Do something cool",
    expected_action_text="my_action()"
)

# Add examples to memory
ltm.add_examples([example])

# Search memory
results = ltm.search("Do something cool", top_k=1)

Short-Term Memory (ReplayBuffer)

ReplayBuffer stores examples from the immediate previous conversation turn.

from kiori.memory import ReplayBuffer

replay_buffer = ReplayBuffer()
replay_buffer.update_buffer([example])

Context Integration

KioriAgent automatically merges contexts from both memory sources.

from kiori.agent import KioriAgent

agent = KioriAgent(ltm=ltm, replay_buffer=replay_buffer)

# Automatically searches LTM and samples STM to generate context examples
ctx = agent.get_context_examples("User's new prompt")
print(ctx)

Philosophy

Kiori is built to be lightweight, easy to understand, and independent of bloated external packages.

License

MIT

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

kiori-0.3.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

kiori-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file kiori-0.3.0.tar.gz.

File metadata

  • Download URL: kiori-0.3.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for kiori-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f441487037be60ad9f1a8fa209f6c4ef5d7868fac75ecb59aa4a212e71605502
MD5 cae8dad3f0f0e042a41c995a3b23507c
BLAKE2b-256 fd669f30de27e61842285a804c3df0fe3f91e6d86e1c5d89a04b979880f79e0e

See more details on using hashes here.

File details

Details for the file kiori-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: kiori-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for kiori-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3ec23f2f2eec07d75feacd1439b71cab74e181b783b68f6586cd6d265c69d61
MD5 0a7c0d90973bede333939c8b74c6153f
BLAKE2b-256 f80d11c338b7cf3f1d235c4ba06ac365e245070b92f8ae6b84ac423ed64ed3c2

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