JITHarnessSnapshot#

Create, compose, unload, and save session-local Python tools. See the guide.

class zett_agent.jit_harness.snapshot.JITHarnessSnapshot(*, format_version=1, tools=(), text_tools=(), base_tools=(), unloaded_tools=())[源代码]#

Portable tool definitions and unload state, separate from history.

Snapshots never contain callables, credentials, connections, or Python globals. Each activation uses the application's supplied base tools; missing base tools do not prevent loading.

示例

Read a snapshot without executing its Python:

snapshot = JITHarnessSnapshot.load("harness.json")

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

参数:
  • format_version (Literal[1, 2])

  • tools (tuple[PythonToolSource, ...])

  • text_tools (tuple[TextToolSource, ...])

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

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

format_version: Literal[1, 2]#

1 stores single-module tools; 2 allows extra package files per tool.

text_tools: tuple[TextToolSource, ...]#

Markdown workflows; older Python-only snapshots default to no text tools.

unloaded_tools: tuple[str, ...]#

Retained names hidden from dispatch until load_tool restores them.

to_json()[源代码]#

Serialize stable, readable JSON without running tool source.

返回类型:

str

classmethod from_json(value)[源代码]#

Validate JSON and its format version without running source.

参数:

value (str)

返回类型:

JITHarnessSnapshot

save(path)[源代码]#

Atomically replace an explicit file; its parent must already exist.

A failed write leaves the old file intact. Saving is controlled by the application, never an automatic model operation.

参数:

path (str | Path)

返回类型:

None

classmethod load(path)[源代码]#

Read and validate a UTF-8 snapshot; Python is not executed.

参数:

path (str | Path)

返回类型:

JITHarnessSnapshot

Fields#

format_version (optional)

See the typed model signature for this field.

tools (optional)

See the typed model signature for this field.

text_tools (optional)

See the typed model signature for this field.

base_tools (optional)

See the typed model signature for this field.

unloaded_tools (optional)

See the typed model signature for this field.