| layout | default |
|---|---|
| title | Chapter 6: Programmatic and Non-Interactive Modes |
| nav_order | 6 |
| parent | Mistral Vibe Tutorial |
Welcome to Chapter 6: Programmatic and Non-Interactive Modes. In this part of Mistral Vibe Tutorial: Minimal CLI Coding Agent by Mistral, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
Vibe can run non-interactively for scripted workflows with bounded turns/cost and structured output.
vibe --prompt "Analyze security risks in src/" --max-turns 5 --max-price 1.0 --output json--max-turnsfor deterministic upper bounds--max-pricefor cost control--outputfor machine-readable integration
You now understand how to use Vibe for script-friendly and CI-ready tasks.
Next: Chapter 7: ACP and Editor Integrations
The ToolCallEvent class in vibe/core/types.py handles a key part of this chapter's functionality:
class ToolCallEvent(BaseEvent):
tool_call_id: str
tool_name: str
tool_class: type[BaseTool]
tool_call_index: int | None = None
args: BaseModel | None = None
class ToolResultEvent(BaseEvent):
tool_name: str
tool_class: type[BaseTool] | None
result: BaseModel | None = None
error: str | None = None
skipped: bool = False
skip_reason: str | None = None
cancelled: bool = False
duration: float | None = None
tool_call_id: str
class ToolStreamEvent(BaseEvent):
tool_name: str
message: str
tool_call_id: str
class CompactStartEvent(BaseEvent):
current_context_tokens: int
threshold: int
# WORKAROUND: Using tool_call to communicate compact events to the client.This class is important because it defines how Mistral Vibe Tutorial: Minimal CLI Coding Agent by Mistral implements the patterns covered in this chapter.
The ToolResultEvent class in vibe/core/types.py handles a key part of this chapter's functionality:
class ToolResultEvent(BaseEvent):
tool_name: str
tool_class: type[BaseTool] | None
result: BaseModel | None = None
error: str | None = None
skipped: bool = False
skip_reason: str | None = None
cancelled: bool = False
duration: float | None = None
tool_call_id: str
class ToolStreamEvent(BaseEvent):
tool_name: str
message: str
tool_call_id: str
class CompactStartEvent(BaseEvent):
current_context_tokens: int
threshold: int
# WORKAROUND: Using tool_call to communicate compact events to the client.
# This should be revisited when the ACP protocol defines how compact events
# should be represented.
# [RFD](https://agentclientprotocol.com/rfds/session-usage)
tool_call_id: str
class CompactEndEvent(BaseEvent):
old_context_tokens: intThis class is important because it defines how Mistral Vibe Tutorial: Minimal CLI Coding Agent by Mistral implements the patterns covered in this chapter.
The ToolStreamEvent class in vibe/core/types.py handles a key part of this chapter's functionality:
class ToolStreamEvent(BaseEvent):
tool_name: str
message: str
tool_call_id: str
class CompactStartEvent(BaseEvent):
current_context_tokens: int
threshold: int
# WORKAROUND: Using tool_call to communicate compact events to the client.
# This should be revisited when the ACP protocol defines how compact events
# should be represented.
# [RFD](https://agentclientprotocol.com/rfds/session-usage)
tool_call_id: str
class CompactEndEvent(BaseEvent):
old_context_tokens: int
new_context_tokens: int
summary_length: int
# WORKAROUND: Using tool_call to communicate compact events to the client.
# This should be revisited when the ACP protocol defines how compact events
# should be represented.
# [RFD](https://agentclientprotocol.com/rfds/session-usage)
tool_call_id: str
class OutputFormat(StrEnum):
TEXT = auto()
JSON = auto()This class is important because it defines how Mistral Vibe Tutorial: Minimal CLI Coding Agent by Mistral implements the patterns covered in this chapter.
The CompactStartEvent class in vibe/core/types.py handles a key part of this chapter's functionality:
class CompactStartEvent(BaseEvent):
current_context_tokens: int
threshold: int
# WORKAROUND: Using tool_call to communicate compact events to the client.
# This should be revisited when the ACP protocol defines how compact events
# should be represented.
# [RFD](https://agentclientprotocol.com/rfds/session-usage)
tool_call_id: str
class CompactEndEvent(BaseEvent):
old_context_tokens: int
new_context_tokens: int
summary_length: int
# WORKAROUND: Using tool_call to communicate compact events to the client.
# This should be revisited when the ACP protocol defines how compact events
# should be represented.
# [RFD](https://agentclientprotocol.com/rfds/session-usage)
tool_call_id: str
class OutputFormat(StrEnum):
TEXT = auto()
JSON = auto()
STREAMING = auto()
type ApprovalCallback = Callable[
[str, BaseModel, str], Awaitable[tuple[ApprovalResponse, str | None]]
]This class is important because it defines how Mistral Vibe Tutorial: Minimal CLI Coding Agent by Mistral implements the patterns covered in this chapter.
flowchart TD
A[ToolCallEvent]
B[ToolResultEvent]
C[ToolStreamEvent]
D[CompactStartEvent]
E[CompactEndEvent]
A --> B
B --> C
C --> D
D --> E