Skip to content

symfonic.agent.backend.plan_digest

plan_digest

Stable, payload-free identity for an Agent composition.

plan_digest

plan_digest(factory: Any, config: Any, output_type: type | None) -> str

Name the model, tool palette, output and terminal-call policy.

Source code in src/symfonic/agent/backend/plan_digest.py
def plan_digest(factory: Any, config: Any, output_type: type | None) -> str:
    """Name the model, tool palette, output and terminal-call policy."""
    material = "|".join(
        (
            type(factory.model_provider).__name__,
            str(getattr(config, "model_name", "")),
            factory.instructions or "",
            ",".join(tool.name for tool in factory.tools.tools),
            output_type.__name__ if output_type else "",
            str(factory.max_model_rounds),
            str(getattr(config, "structured_output_repair_attempts", 0)),
            *(("terminal_synthesis",) if factory.terminal_synthesis is not None else ()),
        )
    )
    return f"sha256:{hashlib.sha256(material.encode('utf-8')).hexdigest()[:32]}"