Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,21 @@

# Marvin

Marvin is a Python framework for building agentic AI workflows.
Marvin is a Python framework for producing structured outputs and building agentic AI workflows.

Marvin provides a structured, developer-focused framework for defining workflows and delegating work to LLMs, without sacrificing control or transparency:
Marvin provides an intuitive API for defining workflows and delegating work to LLMs:

- Cast, classify, extract, and generate structured data from any inputs.
- Create discrete, observable **tasks** that describe your objectives.
- Assign one or more specialized AI **agents** to each task.
- Combine tasks into a **thread** to orchestrate more complex behaviors.


> [!WARNING]
>
> 🚧🚨 Marvin 3.x is under active development, reflected on the `main` branch of this repo. The API may undergo breaking changes, and documentation is still being updated (can be found at [marvin.mintlify.app](https://marvin.mintlify.app)).

## Installation

Install `marvin`:

```bash
# with pip
pip install marvin

# with uv
uv add marvin
uv pip install marvin
```

Configure your LLM provider (Marvin uses OpenAI by default but natively supports [all Pydantic AI models](https://ai.pydantic.dev/models/)):
Expand Down
10 changes: 6 additions & 4 deletions docs/functions/cast.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,18 @@ print(f"{address.street}, {address.city}, {address.country}")
Use instructions to control how text is interpreted and formatted:

```python
from typing import Annotated
import marvin
from pydantic import Field

phone = marvin.cast(
"call me at 1-800-555-0123",
str,
instructions="Extract just the phone number in XXX-XXXX format"
"call me at 800-555-0123",
Comment thread
zzstoatzz marked this conversation as resolved.
Annotated[str, Field(pattern=r"\d{1}-\d{3}-\d{3}-\d{4}")],
instructions="extract the phone number and assume the country code is 1"
)
print(phone)
```

```python
"555-0123"
"1-800-555-0123"
```
5 changes: 2 additions & 3 deletions docs/functions/generate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,13 @@ Generate lists and dictionaries:

```python
import marvin
from typing import List, Dict

# Generate a list of strings
ingredients = marvin.generate(List[str], instructions="Generate recipe ingredients")
ingredients = marvin.generate(list[str], instructions="Generate recipe ingredients")
print(ingredients)

# Generate a dictionary
menu = marvin.generate(Dict[str, float], instructions="Generate menu items with prices")
menu = marvin.generate(dict[str, float], instructions="Generate menu items with prices")
print(menu)
```

Expand Down