Co-authored-by: Carlo <carloantonio.patti@mistral.ai>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Clement Sirieix <clem.sirieix@gmail.com>
Co-authored-by: Michel Thomazo <michel.thomazo@mistral.ai>
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Vincent Guilloux <vincent.guilloux@mistral.ai>
Co-authored-by: Thomas Kenbeek <thomas.kenbeek@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Quentin 2026-02-27 17:31:58 +01:00 committed by GitHub
parent a560a47ce8
commit 5d2e01a6d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
139 changed files with 7152 additions and 1457 deletions

View file

@ -2,12 +2,23 @@ from __future__ import annotations
import asyncio
from vibe import __version__
from vibe.core.agent_loop import AgentLoop
from vibe.core.agents.models import BuiltinAgentName
from vibe.core.config import VibeConfig
from vibe.core.logger import logger
from vibe.core.output_formatters import create_formatter
from vibe.core.types import AssistantEvent, LLMMessage, OutputFormat, Role
from vibe.core.utils import ConversationLimitException, logger
from vibe.core.types import (
AssistantEvent,
ClientMetadata,
EntrypointMetadata,
LLMMessage,
OutputFormat,
Role,
)
from vibe.core.utils import ConversationLimitException
_DEFAULT_CLIENT_METADATA = ClientMetadata(name="vibe_programmatic", version=__version__)
def run_programmatic(
@ -18,6 +29,7 @@ def run_programmatic(
output_format: OutputFormat = OutputFormat.TEXT,
previous_messages: list[LLMMessage] | None = None,
agent_name: str = BuiltinAgentName.AUTO_APPROVE,
client_metadata: ClientMetadata = _DEFAULT_CLIENT_METADATA,
) -> str | None:
formatter = create_formatter(output_format)
@ -28,6 +40,12 @@ def run_programmatic(
max_turns=max_turns,
max_price=max_price,
enable_streaming=False,
entrypoint_metadata=EntrypointMetadata(
agent_entrypoint="programmatic",
agent_version=__version__,
client_name=client_metadata.name,
client_version=client_metadata.version,
),
)
logger.info("USER: %s", prompt)
@ -42,7 +60,7 @@ def run_programmatic(
"Loaded %d messages from previous session", len(non_system_messages)
)
agent_loop.emit_new_session_telemetry("programmatic")
agent_loop.emit_new_session_telemetry()
async for event in agent_loop.act(prompt):
formatter.on_event(event)