Metadata-Version: 2.3
Name: mistralai-vibe-sdk
Version: 0.2.0
Summary: Vibe SDK
Author: Mistral AI
Author-email: Mistral AI <support@mistral.ai>
Requires-Dist: mistralai-vibe-protocol==0.3.1
Requires-Dist: pydantic>=2.0
Requires-Dist: httpx>=0.27
Requires-Dist: mistralai>=1.0
Requires-Dist: structlog>=24.0
Requires-Dist: starlette>=0.37
Requires-Dist: pytest>=8.0 ; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23 ; extra == 'dev'
Requires-Dist: mypy>=1.0 ; extra == 'dev'
Requires-Dist: ruff>=0.4 ; extra == 'dev'
Requires-Dist: rich>=13.0 ; extra == 'examples'
Requires-Dist: textual>=1.0 ; extra == 'examples'
Requires-Dist: uvicorn>=0.29 ; extra == 'examples'
Requires-Dist: pyyaml>=6.0 ; extra == 'examples'
Requires-Dist: mistralai-workflows ; extra == 'workflow'
Requires-Python: >=3.12
Provides-Extra: dev
Provides-Extra: examples
Provides-Extra: workflow
Description-Content-Type: text/markdown

# Vibe SDK

High-level agent interface for the Vibe protocol.

## Quick Start

```python
from mistralai.vibe.protocol.patterns.completion.adapters.mistral import MistralCompletion
from mistralai.vibe.sdk import Agent, AgentConfig

completion = MistralCompletion.from_env(model="mistral-large-latest")
agent = Agent(
    config=AgentConfig(model="mistral-large-latest"),
    completion=completion,
)

# Async
async with agent.session() as session:
    async for state in session.run("Hello"):
        print(state)

# Sync
with agent.session_sync() as session:
    for state in session.run("Hello"):
        print(state)
```

## Custom Local Tasks

To customize the underlying task implementation, pass an
`agent_task_factory`. The factory receives the compiled `AgentTaskConfig`
and the runtime `completion`, then returns any `Task` implementation.
`completion` is still passed to `Agent`; the factory just receives it
explicitly instead of capturing it through a partial.

```python
from mistralai.vibe.protocol import AgentTask
from mistralai.vibe.protocol.patterns.completion.adapters.mistral import MistralCompletion

completion = MistralCompletion.from_env(model="mistral-large-latest")

def build_task(task_config, completion):
    return AgentTask(
        completion=completion,
        tasks={"my_tool": MyTask()},
        model_name=task_config.model,
        name=task_config.name,
        system_prompt=task_config.system_prompt,
        max_iterations=task_config.max_iterations,
    )


agent = Agent(
    config=AgentConfig(model="mistral-large-latest"),
    completion=completion,
    agent_task_factory=build_task,
)
```

## Durable Tasks

Use the durable helper when you want `Agent` sessions to start
workflow-backed tasks instead of local `AgentTask` instances. Install the
workflow extra and import the helper from the workflow namespace.

```python
from mistralai.client import Mistral
from mistralai.vibe.sdk.workflow import create_durable_agent_task_factory

client = Mistral(api_key="...").workflows

agent = Agent(
    config=AgentConfig(model="mistral-large-latest"),
    completion=completion,
    agent_task_factory=create_durable_agent_task_factory(
        client=client,
        task_queue="agents",
    ),
)
```
