35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Tool-authoring primitives for omnigent.
|
|
|
|
Use the :func:`tool` decorator to mark a module-level Python function
|
|
as a tool the agent can call. The decorator derives the LLM-facing
|
|
JSON schema from the function's signature and Google-style docstring;
|
|
the caller just writes Python::
|
|
|
|
from omnigent_client import tool
|
|
|
|
@tool
|
|
def get_current_time() -> dict[str, str]:
|
|
\"\"\"Return the current UTC time as ISO-8601.\"\"\"
|
|
return {"now": datetime.now(timezone.utc).isoformat()}
|
|
|
|
Pass decorated functions as the ``tools=`` argument to
|
|
:meth:`OmnigentClient.query` or :meth:`Session.query`.
|
|
|
|
Server-side runtime (``omnigent.tools.local``) also consumes this
|
|
decorator to load ``@tool``-decorated functions bundled inside agent
|
|
images, so the same decorator powers both authoring and runtime.
|
|
"""
|
|
|
|
from ._decorator import TOOL_MARKER_ATTR, ToolMetadata, get_tool_metadata, tool
|
|
from ._handler import build_tool_handler
|
|
from ._state import ToolState
|
|
|
|
__all__ = [
|
|
"TOOL_MARKER_ATTR",
|
|
"ToolMetadata",
|
|
"ToolState",
|
|
"build_tool_handler",
|
|
"get_tool_metadata",
|
|
"tool",
|
|
]
|