Skip to main content

Python SDK for KIOKU™ — AI Agent Memory & Deliberation Platform

Project description

kioku-memory

Python SDK for KIOKU™ — AI Agent Memory & Deliberation Platform.

KIOKU™ is the only agent memory platform built for decisions, not just context. Store memories, run structured multi-agent deliberations, and get auditable consensus.

Install

pip install kioku-memory

Quick Start

from kioku import KiokuClient

client = KiokuClient(api_key="kk_your_key")

# Store a memory (with new types: temporal, causal, contextual)
memory = client.memories.create(
    "Client prefers morning appointments",
    agent_name="Nika",
    importance=0.8,
    confidence=0.95,
    memory_type="temporal",
)

# Semantic search
results = client.memories.search("scheduling preferences")
for r in results:
    print(f"{r['content']} (similarity: {r.get('similarity', 'N/A')})")

# Create agents from a template
team = client.templates.create_from_template("executive-board")
print(f"Created {len(team['agents'])} agents + room")

# Run a deliberation with human input
session = client.deliberation.start(
    room_id=1,
    topic="Should we switch to a new booking system?",
    debate_rounds=2,
    include_human=True,
)

# Submit human input
client.deliberation.submit_human_input(
    room_id=1,
    session_id=session["sessionId"],
    phase="debate",
    round=1,
    position="I support the switch",
    confidence=0.9,
)

# Check usage
usage = client.usage.get()
print(usage["plan"], usage["usage"]["deliberations"])

Features

  • Memory CRUD — Store, search, update, delete agent memories
  • Semantic Search — pgvector-powered similarity search with HNSW indexing
  • Memory Types — semantic, episodic, procedural, temporal, causal, contextual
  • Confidence Scores — Attach confidence to memories
  • Synaptic Links — Create typed links between memories (causal, supports, contradicts, etc.)
  • Graph Traversal — BFS traversal across memory connections
  • Structured Deliberation — Multi-agent debate with weighted consensus (patented)
  • Human Input — Participate as a human in deliberation sessions
  • Decision Audit Trail — Every deliberation logged with positions, confidence, reasoning
  • Agent Templates — Pre-built agent teams (executive board, technical council, etc.)
  • Polling Mode — External agents can poll for pending turns and respond
  • Usage Metering — Track deliberations, API calls, webhooks, and token usage
  • Agent LLM Config — Configure per-agent LLM provider, API key, and model
  • War Room — Quick deliberation with auto-room creation
  • Forgetting Curve — Automatic memory decay and garbage collection
  • Memory Consolidation — Auto-merge similar memories
  • External Agent Auth — kat_* tokens for agent-to-agent communication
  • GDPR Compliant — Full data export and account deletion
  • Async Support — All methods have async variants (prefix with a)

Async Usage

import asyncio
from kioku import KiokuClient

async def main():
    client = KiokuClient(api_key="kk_your_key")
    results = await client.memories.asearch("user preferences")
    templates = await client.templates.alist()
    usage = await client.usage.aget()
    await client.aclose()

asyncio.run(main())

External Agent Client

For agents participating in deliberations via scoped tokens:

from kioku import ExternalAgentClient

agent = ExternalAgentClient(token="kat_agent_token")

# Poll for pending turns
turns = agent.get_pending_turns()
if turns:
    agent.respond_to_turn(
        turns[0]["id"],
        position="I recommend Option A",
        confidence=0.9,
        reasoning="Based on historical data...",
    )

# Or use direct callback
agent.callback(
    session_id="dlb_abc123",
    position="I recommend Option A",
    confidence=0.9,
    reasoning="Based on historical data...",
)

New in v0.2.0

  • Templatesclient.templates.list(), client.templates.create_from_template(id)
  • Agent LLM Configclient.agents.update_llm(id, provider=..., api_key=..., model=...)
  • Deliberation Human Inputclient.deliberation.submit_human_input(room_id, session_id, ...)
  • Pollingclient.polling.get_pending_turns(), client.polling.respond_to_turn(id, ...)
  • Usageclient.usage.get(), client.usage.get_history(months=6)
  • Memory Types — Added temporal, causal, contextual types + confidence field
  • All new methods have async variants

Links

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

kioku_memory-0.2.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

kioku_memory-0.2.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file kioku_memory-0.2.0.tar.gz.

File metadata

  • Download URL: kioku_memory-0.2.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for kioku_memory-0.2.0.tar.gz
Algorithm Hash digest
SHA256 67a9a4b043bbf7d0561df3aeaef30a3322a3b5f67591d2bd8346f0063c1379a6
MD5 6914a318907def0fff6dbc9734a90c7e
BLAKE2b-256 50f7566d3f628a1a17ec9004dac193f1a5bd03cd09df9214384bb27878675812

See more details on using hashes here.

File details

Details for the file kioku_memory-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kioku_memory-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for kioku_memory-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc3b32931e901b8280ccef6cbdf4513c9872a6b9b8661c775deeed4b1164d41b
MD5 36e918dd7f3e6db3a890ba9182367501
BLAKE2b-256 4a04e7df68eb44f6e9d04a68a70c00e46cfe1d2c8599a672393a7b94e9cf8d09

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