消息与协议对象¶
这些对象用于 Provider、工具和 Agent Loop 之间交换数据。
| 接口 | 用途 |
|---|---|
Message |
模型消息字典类型 |
UserMessage |
run() 接受的用户输入 |
ToolCall |
已解析的工具调用 |
ToolResult |
工具执行结果 |
AgentError |
结构化错误 |
GenerationConfig |
单次模型生成参数 |
MCPServerConfig |
一个 MCP Server 的连接设置 |
业务代码通常不需要手动构造 ModelRequest,但自定义 Provider 会使用它。
公开接口¶
Shared protocols used across Bumblehive subsystems.
AgentError
dataclass
¶
Structured error shared by Bumblehive subsystems.
GenerationConfig
dataclass
¶
Provider-agnostic generation settings for one model request.
effective_max_completion_tokens
property
¶
effective_max_completion_tokens: int
Return the effective positive completion-token limit.
MCPServerConfig
dataclass
¶
Configuration for one FastMCP-connectable server.
effective_tool_timeout
property
¶
effective_tool_timeout: int
Return the effective positive tool timeout in seconds.
ToolCall
dataclass
¶
A parsed tool call ready for registry execution.
to_openai_tool_call ¶
to_openai_tool_call() -> dict[str, Any]
Return this call in Chat Completions assistant-message shape.
ToolResult
dataclass
¶
Result of executing a tool call.
to_openai_tool_message ¶
to_openai_tool_message(*, call: ToolCall | None = None) -> dict[str, Any]
Return this result in Chat Completions tool-message shape.
normalize_user_message ¶
normalize_user_message(value: UserMessage) -> list[Message]
Normalize one user input into the runtime's internal message list.
parse_tool_call ¶
parse_tool_call(raw: Any) -> ToolCall
Parse and validate a raw model tool call into a ToolCall.