Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:7onez Cti expert Pydantic

From Leeroopedia
Knowledge Sources
Domains OSINT, LLMs
Last Updated 2026-10-28 14:00 GMT

Overview

Python 3.10+ environment with Pydantic >= 2.0 for schema-forced structured assessment output in the harness.

Description

This environment provides the Pydantic v2 runtime that powers the Assessment and Plan schemas used by the orchestrator's schema-forced Assess phase. The `ClaudeAgentOptions.output_format` parameter accepts a JSON schema derived from the Pydantic model, forcing the LLM to emit structured output that is validated at the SDK level. The schemas model the IntelAnalysis deliverable: cluster members, alternatives, tier members (kit/neighbour), mentions, and the assessment verdict with confidence levels.

= Usage

Use this environment for the schema-forced assessment phase of the LLM orchestrator. It is the mandatory prerequisite for `Schemas_Assessment` (the Pydantic model definitions) and is transitively required by the orchestrator's Assess phase.

System Requirements

Category Requirement Notes
OS Linux / macOS / WSL2 Same as Python_Stdlib
Hardware Any CPU No GPU needed
Disk 50MB Pydantic + dependencies

Dependencies

System Packages

  • `python3` >= 3.10

Python Packages

  • `pydantic` >= 2.0

Credentials

No credentials required. This is a pure Python library with no API calls.

Quick Install

pip install "pydantic>=2.0"

Code Evidence

Schema imports and model definitions, from `intel_engine/harness/schemas.py:7-12`:

from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, Field

Assessment model with Literal confidence levels, from `intel_engine/harness/schemas.py:81-100`:

class Assessment(BaseModel):
    """The IntelAnalysis deliverable — mirrors the §7 write-up standard."""

    decision_supported: str = Field(
        default="",
        description="one sentence: the question this assessment answers AND the decision it is "
        "meant to support ...",
    )
    bluf: str = Field(
        description="bottom line up front: one sentence with an estimative word "
        "(assessed / likely / possible)"
    )
    cluster: list[ClusterMember] = Field(default_factory=list)
    attribution_level: Literal[
        "same-kit", "same-operator", "same-actor", "inconclusive"
    ] = Field(description="the strongest claim the evidence supports")
    confidence: Literal["low", "moderate", "high"]

Schema-forced output in the orchestrator, from `intel_engine/harness/orchestrator.py:295-298`:

output_format=(
    {"type": "json_schema", "schema": output_schema.model_json_schema()}
    if output_schema else None
),

Common Errors

Error Message Cause Solution
`error_max_structured_output_retries` Schema too complex or too many required fields Reduce required fields; use defaults; keep nesting shallow
`ValidationError` on assessment Model output did not match schema Check Literal enum values; ensure all required fields are present
`ImportError: No module named 'pydantic'` Pydantic not installed `pip install "pydantic>=2.0"`

Compatibility Notes

  • Pydantic v2 only: The schemas use v2 API (`model_json_schema`, `Field(default_factory=...)`). Pydantic v1 is incompatible.
  • Schema design constraint: Deeply nested schemas with many required fields raise `error_max_structured_output_retries`. The Assessment schema deliberately uses defaults and `default_factory` to minimize required fields.
  • Literal types: `attribution_level` and `confidence` use `Literal[...]` to constrain the model's vocabulary — the SDK rejects invalid enum values.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment