# Knowledge Work SDK

> Python SDK for building AI agents that perform research, analysis, and writing tasks using a rubric-based self-verifying loop.

Knowledge Work SDK (kw-sdk) is an open-source Python SDK from ClioAI for building AI agents that handle knowledge work such as research, analysis, writing, and decision-making. It implements a self-verifying agentic loop in which an orchestrator creates a brief and a rubric, executes the task with subagents and tools, and checks the answer against the rubric before submitting. It supports Gemini, OpenAI, and Anthropic models and is released under the MIT license.

## What It Is

The SDK is a harness (`RLHarness` and `AsyncRLHarness`) that turns an open-ended task prompt into a structured run. Because knowledge work has no pass/fail test suite, the SDK synthesizes one: a rubric defining what good output looks like, hidden from the executor. The verifier checks the answer against that rubric, and a failure triggers another iteration. The README says the project began as a harness for running RL training on knowledge tasks.

## Execution Modes

- **Standard**: the orchestrator creates the brief and rubric automatically.
- **Plan**: the user supplies a plan and optionally a rubric for multi-step tasks.
- **Explore**: produces several distinct takes, each with assumptions and counterfactuals, followed by set-level gaps, and uses a quality checklist instead of an accuracy rubric.
- **Iterate**: refines an existing answer using user feedback and optional rubric updates.

Modes can be composed, for example explore, then select, then execute. Custom modes can also be registered.

## Tools and Capabilities

The orchestrator can use optional tools: web search, file system search, stateful Python code execution with tracked artifacts, and an `ask_user` clarification tool that blocks verification until answered. Prompts can include file attachments. Runs can stream events, checkpoint at each step, and resume from a checkpoint with new feedback. Context compaction is available for long tasks.

## Setup Path

Install from GitHub with uv or pip, then set API keys for Gemini, OpenAI, or Anthropic in a `.env` file. Results expose the answer, the rubric used, the mode, and a full execution history.

## Tradeoffs to Know

The README notes that the rubric is generated by the same model that does the work, so the model's blind spots carry over, and that rubrics can be gamed, so human review matters for high-stakes tasks. The verifier checks internal consistency against the rubric, not external correctness. Context compaction requires a Gemini API key regardless of the chosen provider.

## Features
- Self-verifying agentic loop with rubric-based verification
- Standard, plan, explore, and iterate execution modes
- Automatic brief and rubric creation
- Subagent delegation
- Web search tool
- File system search tool
- Stateful Python code execution with artifact tracking
- ask_user clarification tool
- Checkpointing and resume with feedback
- Streaming events
- Context compaction
- Multimodal prompts with file attachments
- Custom modes and providers
- Sync and async harnesses

## Integrations
Gemini, OpenAI, Anthropic

## Platforms
WINDOWS, API, DEVELOPER_SDK

## Pricing
Open Source

## Links
- Website: https://github.com/ClioAI/kw-sdk
- Documentation: https://github.com/ClioAI/kw-sdk/blob/main/SDK_GUIDE.md
- Repository: https://github.com/ClioAI/kw-sdk
- EveryDev.ai: https://www.everydev.ai/tools/knowledge-work-sdk
