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 Claude Agent SDK

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

Overview

Python 3.10+ environment with the Claude Agent SDK (`claude-agent-sdk>=0.1.0`) and `rich>=13.0` for the LLM-driven phased investigation orchestrator and typed MCP tool server.

Description

This environment provides the LLM-driven pipeline brain: the harness orchestrator (`harness/orchestrator.py`) runs a phased Collect→Correlate→Assess loop using the Claude Agent SDK, with each phase exposing only its own tool subset via a typed MCP server (`harness/tools.py`). The SDK handles context management, tool dispatch, and structured output; `rich` provides terminal output. A backend abstraction seam (`sdk_compat.py`) allows the same orchestrator to run against the real Anthropic SDK, a CLI backend (Codex/OMP), or an OpenAI-compatible shim.

Usage

Use this environment for any LLM-driven investigation workflow — the orchestrator's Collect/Correlate/Assess phases, the schema-forced assessment judge, and the MCP tool server. It is the mandatory prerequisite for `Orchestrator_Phase_Run` and `Orchestrator_Judge`. The deterministic pipeline (tools/intel.py) does NOT require this — it is stdlib-only.

System Requirements

Category Requirement Notes
OS Linux / macOS / WSL2 Same as Python_Stdlib
Hardware Any CPU LLM calls are API-based; no local GPU needed
Disk 100MB SDK + vendored skill bodies

Dependencies

System Packages

  • `python3` >= 3.10
  • `node` (optional — for Pele Mermaid rendering in reports)

Python Packages

  • `claude-agent-sdk` >= 0.1.0
  • `rich` >= 13.0
  • `pydantic` >= 2.0 (transitive — required by schemas.py)

Credentials

The following environment variables must be set (in `.env` or the shell environment):

  • `ANTHROPIC_API_KEY`: Anthropic API key for the Claude SDK backend (or be logged into Claude Code).
  • `HARNESS_BACKEND`: Which backend runs the phases — `claude` (default), `codex`, `omp`, or `openai`.
  • `HARNESS_COLLECT_MODEL`: Model for the Collect phase (default `haiku`).
  • `HARNESS_JUDGE_MODEL`: Model for Correlate/Assess phases (default `sonnet`).
  • `HARNESS_ESCALATE_MODEL`: Model for escalated Assess (default `opus`).
  • `HARNESS_MAX_TURNS`: Max turns per phase (default `40`).
  • `HARNESS_PHASE_TIMEOUT`: Wall-clock ceiling per phase in seconds (default `1800`).

Quick Install

pip install "claude-agent-sdk>=0.1.0" "rich>=13.0" "pydantic>=2.0"

Code Evidence

Orchestrator imports from the SDK, from `intel_engine/harness/orchestrator.py:44-51`:

from sdk_compat import (  # noqa: E402  — real Anthropic SDK, the CLI backend, or the OpenAI-compat shim
    AssistantMessage,
    ClaudeAgentOptions,
    HookMatcher,
    ResultMessage,
    ToolUseBlock,
    query,
)

Harness requirements, from `intel_engine/harness/requirements.txt`:

claude-agent-sdk>=0.1.0
pydantic>=2.0
rich>=13.0

Phase options construction, from `intel_engine/harness/orchestrator.py:280-299`:

opts = ClaudeAgentOptions(
    system_prompt=system,
    mcp_servers=servers,
    tools=[],             # remove ALL built-ins (Bash/Read/…) -> force the clean MCP tools,
    allowed_tools=tools,  #   not shell flailing over the skill prompt's bash instructions
    permission_mode="bypassPermissions",
    hooks={"PreToolUse": [HookMatcher(hooks=[_gate_hook(case, label, hostile)])]},
    setting_sources=[],          # don't inherit machine/project .claude settings
    resume=resume,
    max_turns=MAX_TURNS,
    model=model,
    effort=effort,
    output_format=(
        {"type": "json_schema", "schema": output_schema.model_json_schema()}
        if output_schema else None
    ),
)

Common Errors

Error Message Cause Solution
`BackendUnavailable: claude` Auth failure / no API key / credits exhausted Set `ANTHROPIC_API_KEY` or switch `HARNESS_BACKEND` to an available backend
`error_max_structured_output_retries` Assessment schema too complex for model Simplify the Pydantic schema; reduce required fields
`phase timed out after 1800s` Phase exceeded wall-clock ceiling Raise `HARNESS_PHASE_TIMEOUT` or lower `HARNESS_MAX_TURNS`

Compatibility Notes

  • Multiple backends: The `sdk_compat.py` seam lets the same orchestrator run against the Anthropic SDK, Codex CLI, OMP, or an OpenAI-compatible endpoint. Set `HARNESS_BACKEND` to switch.
  • Structured output: Only the final Assess phase uses `output_format` (schema-forced). Intermediate phases return free text to avoid retry overhead.
  • Cost tracking: `total_cost_usd` reflects Anthropic model cost only — third-party API credits (FOFA, WhoisXML, etc.) are tracked separately.

Related Pages

Page Connections

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