mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 04:54:36 +00:00
Phase 0 integration complete - verified minimal loop with local-agent stub runner. Changes: - Add AgentRunOrchestrator for plugin-based agent execution - Add AgentResultNormalizer for Protocol v1 result conversion - Add AgentRunnerDescriptor for runner ID parsing (plugin:author/name/runner) - Update chat handler to use new orchestrator instead of direct runner lookup - Add plugin handler methods for list_agent_runners and run_agent - Add connector methods for AgentRunner protocol forwarding - Update pipeline API to include runner options in metadata - Add integration docs and implementation plan Integration verified: - Runner: plugin:langbot/local-agent/default - Input: "你好" - Output: [stub] Echo: 你好 - Date: 2026-05-10 10:09 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
72 lines
2.1 KiB
Python
72 lines
2.1 KiB
Python
"""Agent runner descriptor."""
|
|
from __future__ import annotations
|
|
|
|
import typing
|
|
import pydantic
|
|
|
|
|
|
class AgentRunnerDescriptor(pydantic.BaseModel):
|
|
"""Descriptor for an agent runner.
|
|
|
|
Represents the discovered metadata for a runner, including
|
|
its identity, capabilities, permissions, and configuration schema.
|
|
"""
|
|
|
|
id: str
|
|
"""Unique runner ID: plugin:author/plugin_name/runner_name"""
|
|
|
|
source: typing.Literal['plugin']
|
|
"""Runner source type"""
|
|
|
|
label: dict[str, str]
|
|
"""Display labels keyed by locale (e.g., en_US, zh_Hans)"""
|
|
|
|
description: dict[str, str] | None = None
|
|
"""Optional description keyed by locale"""
|
|
|
|
plugin_author: str
|
|
"""Plugin author from manifest"""
|
|
|
|
plugin_name: str
|
|
"""Plugin name from manifest"""
|
|
|
|
runner_name: str
|
|
"""AgentRunner component name from manifest"""
|
|
|
|
plugin_version: str | None = None
|
|
"""Optional plugin version"""
|
|
|
|
protocol_version: str = '1'
|
|
"""SDK protocol version, default '1'"""
|
|
|
|
config_schema: list[dict[str, typing.Any]] = []
|
|
"""Configuration schema using DynamicForm format"""
|
|
|
|
capabilities: dict[str, bool] = {}
|
|
"""Runner capabilities: streaming, tool_calling, knowledge_retrieval, etc."""
|
|
|
|
permissions: dict[str, list[str]] = {}
|
|
"""Requested permissions: models, tools, knowledge_bases, storage, files, platform_api"""
|
|
|
|
raw_manifest: dict[str, typing.Any] = {}
|
|
"""Original manifest for reference"""
|
|
|
|
model_config = pydantic.ConfigDict(
|
|
extra='allow',
|
|
)
|
|
|
|
def get_plugin_id(self) -> str:
|
|
"""Return plugin identifier as author/name."""
|
|
return f'{self.plugin_author}/{self.plugin_name}'
|
|
|
|
def supports_streaming(self) -> bool:
|
|
"""Check if runner supports streaming output."""
|
|
return self.capabilities.get('streaming', False)
|
|
|
|
def supports_tool_calling(self) -> bool:
|
|
"""Check if runner supports tool calling."""
|
|
return self.capabilities.get('tool_calling', False)
|
|
|
|
def supports_knowledge_retrieval(self) -> bool:
|
|
"""Check if runner supports knowledge retrieval."""
|
|
return self.capabilities.get('knowledge_retrieval', False) |