jeevesagent.tools.registry¶
In-process tool registry.
A Tool wraps a Python callable with a JSON-Schema-style input
description. tool() is a decorator that derives the schema from
type hints. InProcessToolHost is the simplest
ToolHost: a dict keyed by tool name.
Attributes¶
Classes¶
A dict-backed |
|
A registered tool: definition plus the callable that executes it. |
Functions¶
Module Contents¶
- class jeevesagent.tools.registry.InProcessToolHost(tools: list[Tool | collections.abc.Callable[Ellipsis, Any]] | None = None)[source]¶
A dict-backed
ToolHost.- async call(tool: str, args: collections.abc.Mapping[str, Any], *, call_id: str = '') jeevesagent.core.types.ToolResult[source]¶
- register(item: Tool | collections.abc.Callable[Ellipsis, Any]) Tool[source]¶
- async watch() collections.abc.AsyncIterator[jeevesagent.core.types.ToolEvent][source]¶
In-process registry is static; the generator yields nothing.
Iterating over an empty tuple keeps this an async generator (so the return type is
AsyncIterator) without ever producing an event at runtime.
- class jeevesagent.tools.registry.Tool[source]¶
A registered tool: definition plus the callable that executes it.
- async execute(args: collections.abc.Mapping[str, Any]) Any[source]¶
Invoke the underlying callable.
Async functions are awaited; sync functions are dispatched to a worker thread via
anyio.to_thread.run_sync()so they don’t block the event loop.
- fn: collections.abc.Callable[Ellipsis, Any]¶
- jeevesagent.tools.registry.tool(fn: collections.abc.Callable[Ellipsis, Any]) Tool[source]¶
- jeevesagent.tools.registry.tool(*, name: str | None = None, description: str | None = None, destructive: bool = False) collections.abc.Callable[[collections.abc.Callable[Ellipsis, Any]], Tool]
Promote a callable to a
Tool.Use as
@tool(bare) or@tool(name=..., description=..., destructive=...). The schema is derived from parameter annotations; primitive types map to their JSON-Schema equivalents, anything else falls back tostring.
- jeevesagent.tools.registry.ToolCallable¶