xr_ai_tools#
Toolkit-independent native XR tools.
Submodules#
- xr_ai_tools.async_tools
- xr_ai_tools.current_frame
- xr_ai_tools.image
- xr_ai_tools.image_polygon
- xr_ai_tools.marker_tracking
- xr_ai_tools.rag
- xr_ai_tools.rpc
- xr_ai_tools.spatial
- xr_ai_tools.text_memory
- xr_ai_tools.tool_calling
- xr_ai_tools.tools
- xr_ai_tools.tracking
- xr_ai_tools.types
- xr_ai_tools.video_memory
- xr_ai_tools.vision
Classes#
A validated asynchronous tool independent of any output transport. |
|
A Pydantic-validated tool shared by agents, voice, and background triggers. |
|
A model-visible result from one local tool invocation. |
|
A native tool catalog with model-visible dispatch names. |
Package Contents#
- class xr_ai_tools.AsyncTool(
- name: str,
- description: str,
- request_model: type[RequestT],
- chunk_model: type[ChunkT],
- handler: collections.abc.Callable[[RequestT], collections.abc.AsyncIterator[ChunkT]],
A validated asynchronous tool independent of any output transport.
- async stream(
- request: RequestT | collections.abc.Mapping[str, object],
Validate and yield chunks produced in an isolated Relay tool scope.
The producer task owns the scope and handler cleanup; chunks are yielded in the consumer’s context. Parent scope-local registrations are not transferred into the isolated context.
- class xr_ai_tools.Tool(
- name: str,
- description: str,
- request_model: type[RequestT],
- result_model: type[pydantic.BaseModel] | None,
- handler: collections.abc.Callable[[RequestT], collections.abc.Awaitable[ResultT] | ResultT],
- *,
- return_direct: bool = False,
- render_result: collections.abc.Callable[[ResultT], str] | None = None,
A Pydantic-validated tool shared by agents, voice, and background triggers.
- async execute(request: RequestT) ResultT#
Run one validated request through the shared Relay tool lifecycle.
- async invoke(arguments: str) ToolInvocationResult#
Validate and run one model-supplied JSON argument payload.
- class xr_ai_tools.ToolInvocationResult#
A model-visible result from one local tool invocation.
- content: str#
Model-visible serialized result or validation error.
- return_direct: bool#
Whether the agent should return the content without another model turn.