Surface · Agentic

An assistant that does legal work, not chatbot demos.

A multi-turn, tool-using, memory-keeping agent runtime designed for the real shape of legal work — research, briefing, intake, redlining. It composes the rest of KAOS: it reads documents through the typed model, calls extraction and search tools across the platform, checks its citations, and keeps a tamper-evident audit trail of every step — so a lawyer can review every claim before it leaves the building. The agent assists; a human stays accountable.

Terminal window
pip install 'kaos-agents[llm]'

Agent definition, separate from the engine

An Agent is a frozen, declarative config — instructions, model, tools, pattern, hooks, refusal policy. A Runner is the engine that executes it — runtime, context, file system, hooks. One agent definition runs across many runner instances. The agent is stateless by design; every persistent fact lives in SessionMemory, which is auditable and bounded.

Three behaviors come ready: a chat agent that calls tools in a reason-and-act loop on a 30-tool default budget; a plan-execute agent that builds an adaptive plan graph; and a research agent that retrieves, grounds, and verifies citations. The default retriever is plain BM25 because cross-domain BEIR evaluation showed adaptive retrieval did worse — a small example of the empirical discipline kaos-agents follows.

What happens on every turn

Every call walks the same path. Cost and tokens accumulate per step; the trace is what the audit log records.

Classify 01 Plan 02 Tool 03 Memory 04 Reply 05 intent routing recipe lookup plan graph MCP call permission check evict + persist BM25 search cited answer cost report OUTCOME

Memory the agent can keep, search, and audit

Memory is divided into named sections, each with its own token budget, eviction policy, summarization rule, and persistence mode. The four searchable sections — findings, actions, messages, documents — are queryable by BM25, so an agent can recall a fact from earlier in the same session. The documents section is unbounded so a deal-room corpus fits. Every change is hash-chained for a tamper-evident audit log.

AUDIT tamper-evident hash chain PLANNING_CONTEXT · PLAN_HISTORY · PLAN_EXAMPLES plan-tier sections WORKING · LAST_INTENT · REFLECTION control-tier sections FINDINGS · ACTIONS · MESSAGES turn-tier sections (BM25 searchable) DOCUMENTS unbounded corpus (BM25 searchable) PLAYBOOKS · ROLE persona-tier sections

Recipes named for real legal work

6 planning recipes auto-load into PLAN_EXAMPLES at session start: contract-extraction, corpus-qa, edgar-research, federal-register-research, legal-review, summarization.

7 extraction recipes are Harvey-Workflow-shaped with published recall floors: merger-agreement, spa-deal-points, lease, lpa, court-opinion, privilege-classification, change-of-control.

Source: the kaos-agents repo — kaos_agents/recipes/ and recipes/extraction/.

A taste

The Python entry point: ask a deal-room research agent which provisions trip on a change of control, and stream the answer with citations. The same recipes also drive a one-line CLI for an associate who wants Excel back, not Python.

from kaos_agents import Agent, AgentPattern, Runner
agent = Agent(
instructions="You are a buy-side M&A diligence associate.",
pattern=AgentPattern.RESEARCH,
tools=("kaos-source-*", "kaos-pdf-*", "kaos-citations-*"),
model="anthropic:claude-haiku-4-5",
)
runner = Runner(agent, runtime=runtime)
prompt = "List every clause in the deal room that is triggered by a change of control."
async for event in runner.run(prompt, session_id="project-orion"):
print(event) # Span(TURN), IntentClassified, StreamDelta…, CitationFound
Terminal window
# Same recipes, run from the shell, returning a populated Excel.
kaos-extract --recipe merger-agreement \
--files "deal-room/*.pdf" \
--output project-orion-deal-points.xlsx
kaos-extract --recipe privilege-classification \
--files "production-001/" \
--output privilege-log.xlsx

How it compares

vs. LangGraph, AutoGen, OpenAI Assistants. kaos-agents is built around the real shape of legal work — long-running sessions, document corpora as memory, recipes named for legal tasks, hash-chained audit logs. The 15-section memory model with per-section budgets and bitemporal queries is the strategic differentiator. No open-source agent framework today ships the combination of features legal workflows need (typed sectioning, multi-tenant isolation, audit log, configurable policies per workflow profile).

vs. proprietary workflow-builders (Harvey, Lexis+ Protégé). Proprietary platforms ship a workflow-builder UX where users compose pre-built steps. The KAOS answer: the LLM is the workflow builder, and our job is to give it well-shaped tools. A recipe named merger-agreement is one JSON file that loads into memory at session start. Modify it, fork it, ship your own — without a platform vendor in the loop.

See /compare.

Get started

See the quickstart, browse all 18 packages, or read the docs.