Vibe Protocol - event-sourced agentic orchestration
Project description
Vibe Protocol
Package for the Task protocol — composable, observable, durable agentic orchestration.
Overview
vibe_sdk is built around the Task, a single abstraction that unifies tools, agents, and workflows under one protocol. Every Task shares the same interface: input, output, streaming history updates, a terminal result event, and recursive subtask composition.
- One interface for everything: Tools, LLM agents, workflows, and sandboxed code are all Tasks
- Recursive composability: Tasks compose into observable trees at any depth
- Streaming observability: History updates stream as JSON patches, followed by one terminal task result
- Port/adapter design: Pluggable LLM backends via the CompletionModel protocol
- Durability-ready: TaskState is the complete checkpoint — serialize, store, resume
Installation
uv sync
For development dependencies:
uv sync --all-extras
Quick Start
MISTRAL_API_KEY=<your-key> uv run python examples/demo_simple.py
Simple Agent with Tools
from vibe_sdk import AgentTask, ToolTask, TaskState, PendingOutput, MessageEntry, MessageEntryPayload
from vibe_sdk.patterns.completion.adapters.mistral import MistralAdapter
def add_numbers(a: float, b: float) -> str:
return str(a + b)
completion = MistralAdapter(api_key=api_key)
add_tool = ToolTask(fn=add_numbers, name="add_numbers", description="Add two numbers")
agent = AgentTask(
completion=completion,
tasks={"add_numbers": add_tool},
system_prompt="You are a helpful assistant.",
)
state = TaskState(
id="demo",
output=PendingOutput(),
history=[MessageEntry(payload=MessageEntryPayload(role="user", content="What is 3 + 4?"))],
)
channel = await agent.run(state)
async for message in channel:
# history_update events stream while the task runs,
# then one terminal task_result carries the final TaskState.
print(message)
Nested Agents (Subtask Delegation)
researcher = AgentTask(
completion=completion,
tasks={"search_web": search_tool},
name="researcher",
description="Research a topic using web search",
system_prompt="Research the given topic, then summarize findings.",
input_schema={"type": "object", "properties": {"topic": {"type": "string"}}},
)
orchestrator = AgentTask(
completion=completion,
tasks={"researcher": researcher},
system_prompt="Delegate research to the 'researcher' tool, then synthesize.",
)
channel = await orchestrator.run(state)
async for message in channel:
print(message)
The orchestrator LLM sees researcher as a tool. When it calls researcher(topic="quantum computing"), the runtime spawns a nested agent loop with its own LLM and tools. The parent receives structured output as a tool result.
Documentation
- ARCHITECTURE.md — System design, module structure, and data flow
- TODO.md — Implementation roadmap
- documentation/INDEX.md — Index of design docs, RFCs, and protocol specs
- presentation/README.md — Slide-ready markdown for SDK architecture explanations
Development
# Type checking
uv run mypy src/vibe_sdk/
# Linting
uv run ruff check src/vibe_sdk/
# Tests
uv run pytest tests/
Project Structure
src/vibe_sdk/
__init__.py # Package exports
patch.py # RFC 6902 JSON Patch ops + AppendOp extension
logging.py # Structured logging configuration
protocol/ # Pure types and contracts
state.py # TaskState, HistoryEntry, TaskOutput
events.py # history_update, task_result, callback_* messages
channel.py # Channel protocol
task.py # Task protocol (@runtime_checkable)
modules/ # Generic engine components
execution.py # ExecutionLoop, StateModule ABC, Downstream protocol
sub_task.py # sub_task_reducer, subtask event/effect types
produce.py # Immer-like produce() + diff()
json_patch.py # apply_patches(), reroute_patches()
task.py # ModuleTask base class, TaskConfigBase
bindings/ # Transport integrations
local.py # LocalChannel (in-process, asyncio.Queue)
streamable_http.py # HTTP/SSE transport for cross-process communication
workflow_api/ # Temporal workflow integration
channel.py # WorkflowAPIChannel (NATS JetStream)
callback.py # WorkflowCallbackBridge
executor.py # WorkflowEffectExecutor
streaming.py # WorkflowStateSink
task.py # WorkflowAPIRemoteTask
types.py # Workflow-specific types
workflow.py # DurableAgentWorkflow
patterns/ # Concrete task implementations
agent.py # AgentTask, AgentModule (LLM-driven orchestration)
tool.py # ToolTask (function wrapper)
completion/ # LLM completion domain
port.py # CompletionModel protocol
types.py # CompletionRequest, CompletionChunk
messages.py # Message, ToolCall, FunctionCall
bridge.py # stream_to_mutations, build_completion_request
adapters/
mistral.py # Mistral API adapter
tests/
conftest.py # Shared test factories and mocks
test_protocol_types.py # Protocol type tests
test_produce.py # produce() / diff() tests
test_execution_loop.py # ExecutionLoop tests
test_replay_invariants.py # Reducer/loop invariant tests
test_effect_handlers.py # Standalone effect handler tests
test_agent_reducer.py # AgentModule reducer unit tests
test_sub_task.py # sub_task_reducer tests
test_tool_task.py # ToolTask tests
test_stream_bridge.py # LLM streaming bridge tests
test_agent_task.py # AgentTask integration tests
examples/
demo_simple.py # Simple tool-calling agent
demo_subagents.py # Nested agents with parallel subtasks
demo_callbacks.py # Callback mechanism demonstration
demo_networked_server.py # Agent served over Streamable HTTP (uvicorn)
demo_networked_client.py # Orchestrator calling a remote agent over HTTP
render.py # Rendering utilities for example output
run.py # Unified demo runner (YAML config-based)
configs/ # Demo configurations
simple.yaml # Basic agent with tools
subagents.yaml # Parent with child researchers
callbacks.yaml # Callback resolution patterns
triple_callback.yaml # 3-level callback chain
agent_callback.yaml # Agent-as-callback implementation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mistralai_vibe_protocol-0.1.1.tar.gz.
File metadata
- Download URL: mistralai_vibe_protocol-0.1.1.tar.gz
- Upload date:
- Size: 49.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8e8862edbefb9d4b018926d0516d4e0b84d90c17c6cf3374ad90a559d2cb778
|
|
| MD5 |
c386bb8a7cf8a6ac6a1a62817beb67f0
|
|
| BLAKE2b-256 |
8bc7cf182ca0f9879ae605db45427e2f04e8582b493152443d19f62b1109d257
|
Provenance
The following attestation bundles were made for mistralai_vibe_protocol-0.1.1.tar.gz:
Publisher:
release.yml on mistralai/vibe-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mistralai_vibe_protocol-0.1.1.tar.gz -
Subject digest:
d8e8862edbefb9d4b018926d0516d4e0b84d90c17c6cf3374ad90a559d2cb778 - Sigstore transparency entry: 1311114370
- Sigstore integration time:
-
Permalink:
mistralai/vibe-protocol@0268a33a7e060005bb7878ef849ff1fe3fbe9a0a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mistralai
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0268a33a7e060005bb7878ef849ff1fe3fbe9a0a -
Trigger Event:
release
-
Statement type:
File details
Details for the file mistralai_vibe_protocol-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mistralai_vibe_protocol-0.1.1-py3-none-any.whl
- Upload date:
- Size: 66.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
851c5ccf84f223be16657d812500d9d99bc7dd30ac0bc8d866c53b59290f344f
|
|
| MD5 |
59408b53c335b6732f36023ddc9ad5db
|
|
| BLAKE2b-256 |
7251a1fb98fa42922dd144fe08bd71fb7337885c489d885b690fe0a5aaf912b9
|
Provenance
The following attestation bundles were made for mistralai_vibe_protocol-0.1.1-py3-none-any.whl:
Publisher:
release.yml on mistralai/vibe-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mistralai_vibe_protocol-0.1.1-py3-none-any.whl -
Subject digest:
851c5ccf84f223be16657d812500d9d99bc7dd30ac0bc8d866c53b59290f344f - Sigstore transparency entry: 1311114419
- Sigstore integration time:
-
Permalink:
mistralai/vibe-protocol@0268a33a7e060005bb7878ef849ff1fe3fbe9a0a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mistralai
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0268a33a7e060005bb7878ef849ff1fe3fbe9a0a -
Trigger Event:
release
-
Statement type: