Metadata-Version: 2.5
Name: levain-sdk
Version: 0.1.141
Summary: SDK for building Levain agent recipes
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: claude-agent-sdk==0.2.161
Requires-Dist: langchain-core==1.6.4
Provides-Extra: crawler
Requires-Dist: trafilatura==2.2.0; extra == 'crawler'
Provides-Extra: models
Requires-Dist: langchain-anthropic==1.7.4; extra == 'models'
Requires-Dist: langchain-openai==1.6.6; extra == 'models'
Provides-Extra: review
Requires-Dist: fastmcp==4.0.5; extra == 'review'
Requires-Dist: githubkit==0.16.1; extra == 'review'
Description-Content-Type: text/markdown

# levain-sdk

The Python interface that [Levain](https://levainlabs.com) agent
recipes are written against: node helpers, the agentic engine, state
reducers, and tool annotations.

A recipe's node functions import from `levain_sdk`, so this package is
what makes a cloned recipe installable and readable in your editor —
type checking, completion, and `uv sync` all resolve against it.
Agents execute on the Levain platform; this package defines the
contract, it does not run them.

## Install

Recipe packages already declare `levain-sdk`, so inside a cloned
recipe:

```
uv sync
```

Or directly:

```
pip install levain-sdk
```

### Extras

- `models` — direct (non-agentic) LLM calls via `levain_sdk.models`.
- `review` — helpers used by review-oriented recipes.
- `crawler` — main-content extraction for crawling recipes.

Most recipes need none of these; the error message will name the
extra if a module you import requires one.

## Wiki

`levain_sdk.wiki` reads the workspace knowledge base from node code,
with no agent loop: `read_page(path)`, `search(query, limit)` and
`list_pages()`. All three are async, take their configuration from the
sandbox environment, and report failures as `{"error": ..., "code": ...}`
rather than raising. The
[Knowledge Base guide](https://docs.levainlabs.com/guides/knowledge-base)
has the example and the list of codes.

## Authoring recipes

Validation and code generation live in the companion tool,
[levain-cli](https://pypi.org/project/levain-cli/). The full authoring
guide is at [docs.levainlabs.com](https://docs.levainlabs.com).

## License

Apache-2.0.
