Tools & Registry Reference¶
This section documents the tool abstraction layer, execution context, tool result payloads, and the tool registry.
BaseTool & Context¶
edgevoiceai.tools.base ¶
Base abstractions for pluggable tools in the Voice AI Framework.
BaseTool ¶
Bases: ABC
Abstract Base Class for any Voice Agent Tool. Implementations specify schema, trigger description, and async execution logic.
Source code in edgevoiceai/tools/base.py
description
abstractmethod
property
¶
Tool description in language(s) optimized for LLM trigger.
prompt_instruction
property
¶
Optional system prompt guideline/rule for this tool. If provided, the framework automatically composes this rule into the AI's system prompt.
execute
abstractmethod
async
¶
Asynchronously execute tool with provided arguments and session context.
to_function_declaration ¶
Converts this tool into a Gemini API function declaration object.
ToolExecutionContext
dataclass
¶
Context passed into every tool execution call. Contains session details, turn counter, and optional client message emitter.
Source code in edgevoiceai/tools/base.py
emit_to_client
async
¶
Sends an event back to the client interface (e.g., browser or device UI).
Source code in edgevoiceai/tools/base.py
ToolResult
dataclass
¶
Unified return type for any tool executed within the Voice AI engine.
Source code in edgevoiceai/tools/base.py
to_gemini_response_content ¶
Formats the result into the dictionary expected by Gemini's toolResponse.
Source code in edgevoiceai/tools/base.py
ToolRegistry¶
edgevoiceai.tools.registry ¶
Central ToolRegistry for discovering, registering, and dynamically dispatching tool calls.
ToolRegistry ¶
Manages a collection of BaseTool instances and handles dispatching tool calls.
Source code in edgevoiceai/tools/registry.py
build_tools_instruction ¶
Aggregates prompt instructions from all registered tools into a unified guideline block. Ensures the AI assistant strictly understands when and how to call active tools.
Source code in edgevoiceai/tools/registry.py
dispatch
async
¶
Dynamically dispatches a tool call to the registered handler. Emits client events if the tool produces any.
Source code in edgevoiceai/tools/registry.py
get ¶
has_tool ¶
list_tools ¶
register ¶
Registers a tool instance. Overwrites existing registration if name matches.
to_gemini_tools_payload ¶
Builds the Gemini Live tools array configuration:
[{"functionDeclarations": [...]}]