ToolSpec#

Let a model keep its own tools and notes in a repository on disk. See the guide.

class zett_agent.jit_harness.host.ToolSpec(name, description, parameters, guidelines, snippet, execution_mode, return_schema=None, returns_description='')[源代码]#

Everything the agent needs to know about a repository tool before calling it.

It is the serializable half of an AgentTool: the schema and the prompt-facing text, without the handler that only lives where the code runs.

参数:
  • name (str)

  • description (str)

  • parameters (dict[str, JsonValue])

  • guidelines (tuple[str, ...])

  • snippet (str)

  • execution_mode (ToolExecutionMode)

  • return_schema (dict[str, JsonValue] | None)

  • returns_description (str)

classmethod of(tool)[源代码]#

Describe one imported tool.

参数:

tool (AgentTool)

返回类型:

ToolSpec

to_json()[源代码]#

Render this spec as the JSON object the child sends.

返回类型:

dict[str, JsonValue]

classmethod from_json(payload)[源代码]#

Read one spec from the child, rejecting anything that is not a tool description.

参数:

payload (Mapping[str, JsonValue])

返回类型:

ToolSpec

build(invoke)[源代码]#

Rebuild the tool in the agent, with invoke as its handler.

参数:

invoke (Callable[[dict[str, JsonValue]], Awaitable[ToolResult]])

返回类型:

AgentTool