repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
deepagents
libs/deepagents/tests/unit_tests/middleware/test_summarization_middleware.py
.py
"""Unit tests for `SummarizationMiddleware` with backend offloading.""" import asyncio import base64 as _base64 import hashlib import inspect import re import time from collections.abc import Callable from typing import TYPE_CHECKING, Any, cast from unittest.mock import AsyncMock, MagicMock import pytest from langcha...
3,558
140,107
deepagents
libs/deepagents/tests/unit_tests/middleware/test_memory_middleware_async.py
.py
"""Async unit tests for memory middleware with FilesystemBackend. This module contains async versions of memory middleware tests. """ from pathlib import Path from langchain.agents import create_agent from langchain_core.messages import AIMessage, HumanMessage from deepagents.backends.filesystem import FilesystemBa...
402
14,214
deepagents
libs/deepagents/tests/unit_tests/middleware/test_summarization_factory.py
.py
"""Unit tests for the summarization middleware factory.""" from collections.abc import Iterable from inspect import Parameter, signature from typing import Any, cast from unittest.mock import MagicMock import pytest from langchain_core.messages import AIMessage, MessageLikeRepresentation from deepagents.middleware.s...
95
4,197
deepagents
libs/deepagents/tests/unit_tests/middleware/test_execute_route_prompt.py
.py
"""Tests for the shell-vs-virtual-path prompt section (issue #3050). `execute` runs on the default backend's host shell, so routed virtual paths (e.g. `/common/`) don't exist there. Instead of rewriting commands — which can't be done correctly for arbitrary shell — the middleware tells the model how to translate each ...
158
6,214
deepagents
libs/deepagents/tests/unit_tests/middleware/test_subagent_middleware_init.py
.py
"""Unit tests for SubAgentMiddleware initialization and configuration.""" import json from typing import Any, get_type_hints import pytest from langchain.agents import create_agent from langchain.agents.structured_output import AutoStrategy from langchain.tools import ToolRuntime from langchain_core.callbacks import ...
510
18,191
deepagents
libs/deepagents/tests/unit_tests/middleware/test_tool_schemas.py
.py
"""Unit tests for tool schema validation.""" from langchain_core.tools import StructuredTool from deepagents.backends.state import StateBackend from deepagents.middleware.filesystem import FilesystemMiddleware class TestFilesystemToolSchemas: """Test that filesystem tool JSON schemas have types and descriptions...
98
4,394
deepagents
libs/deepagents/tests/unit_tests/middleware/test_filesystem_middleware_init.py
.py
"""Unit tests for FilesystemMiddleware initialization and configuration.""" from typing import Any import pytest from langchain.agents import create_agent from langchain_anthropic import ChatAnthropic from langgraph.store.memory import InMemoryStore from deepagents.backends import CompositeBackend, StateBackend, Sto...
116
4,950
deepagents
libs/deepagents/tests/unit_tests/middleware/test_filesystem_video.py
.py
import base64 from typing import cast import pytest from langchain.agents.middleware.types import ModelRequest, ModelResponse from langchain.tools import ToolRuntime from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langchain_core.messages.utils import convert_to_openai_messages from langgr...
614
25,943
deepagents
libs/deepagents/tests/unit_tests/middleware/test_video_deps.py
.py
"""Unit tests for `video_dependencies_available`, the optional-extra gate. These tests monkeypatch `importlib.util.find_spec` so they run without the `[video]` extra actually being installed — unlike `test_video.py`, which `importorskip`s the real PyAV decoder. """ import importlib.util import pytest from deepagent...
42
1,761
deepagents
libs/deepagents/tests/unit_tests/middleware/test_video.py
.py
"""Unit tests for the PyAV-based video frame extractor. The tests exercise the real PyAV decoder against a synthetic 3-second clip so the offset/limit -> seconds reinterpretation, frame sampling, validation, and error mapping all run end-to-end. They are skipped automatically when the `av` (PyAV) extra is not installe...
481
17,040
deepagents
libs/deepagents/tests/benchmarks/test_benchmark_create_deep_agent.py
.py
"""Wall-time benchmarks for `create_deep_agent` graph construction. Run locally: `make benchmark` Run with CodSpeed: `uv run --group test pytest ./tests -m benchmark --codspeed` These tests measure the wall time of building a `CompiledStateGraph` via `create_deep_agent` under various configurations. They do NOT inv...
216
7,268
deepagents
libs/deepagents/tests/benchmarks/test_benchmark_summarization_middleware.py
.py
"""Wall-time benchmarks for `SummarizationMiddleware` per-model-call overhead. Run locally: `make -C libs/deepagents benchmark` Run with CodSpeed: `make -C libs/deepagents bench` These tests measure the wall time of `wrap_model_call` / `awrap_model_call` on the *common* path -- the one taken on every model invocati...
175
6,589
deepagents
libs/deepagents/tests/integration_tests/test_context_hub_backend.py
.py
"""Integration tests for ContextHubBackend against a real LangSmith Hub. Skipped unless `LANGSMITH_API_KEY` is set. Each test fixture creates a uniquely-named throwaway agent repo and deletes it on teardown, so these tests are safe to run against a real tenant. """ from __future__ import annotations import logging i...
226
8,264
deepagents
libs/deepagents/tests/integration_tests/test_hitl.py
.py
"""Integration tests for human-in-the-loop interrupt configuration. Verifies that `create_deep_agent`'s `interrupt_on` config correctly pauses execution for approval, respects per-tool decision settings, and propagates interrupt config through subagent delegation. These tests assert SDK structural state (interrupt pa...
209
7,993
deepagents
libs/deepagents/tests/integration_tests/test_filesystem_middleware.py
.py
import unicodedata import uuid import pytest from langchain.agents import create_agent from langchain.agents.middleware import AgentMiddleware from langchain_anthropic import ChatAnthropic from langchain_core.messages import HumanMessage from langgraph.checkpoint.memory import MemorySaver from langgraph.store.memory i...
1,055
42,125
deepagents
libs/deepagents/tests/integration_tests/test_langsmith_sandbox.py
.py
from __future__ import annotations import os from typing import TYPE_CHECKING import pytest from langchain_tests.integration_tests import SandboxIntegrationTests from langsmith.sandbox import SandboxClient from deepagents.backends.langsmith import LangSmithSandbox if TYPE_CHECKING: from collections.abc import I...
64
2,602
deepagents
libs/deepagents/tests/integration_tests/test_deepagents.py
.py
from __future__ import annotations import pytest from langchain.agents import create_agent from langchain.agents.structured_output import ToolStrategy from langchain_core.messages import HumanMessage from pydantic import BaseModel from deepagents.graph import create_deep_agent from tests.utils import ( SAMPLE_MOD...
147
7,456
deepagents
libs/deepagents/tests/integration_tests/test_subagent_middleware.py
.py
import json from typing import ClassVar import pytest from langchain.agents.middleware import AgentMiddleware from langchain.agents.structured_output import ToolStrategy from langchain_core.messages import AIMessage, HumanMessage from langchain_core.tools import tool from pydantic import BaseModel, Field from deepage...
266
10,628
deepagents
libs/deepagents/scripts/check_imports.py
.py
"""Check imports script. Quickly verify that a list of Python files can be loaded by the Python interpreter without raising any errors. Ran before running more expensive tests. Useful in Makefiles. If loading a file fails, the script prints the problematic filename and the detailed error traceback. """ import random...
31
893
deepagents
libs/cli/deepagents_cli/main.py
.py
"""Entry point for the `deepagents` CLI. This CLI exposes the deployment-oriented commands for Managed Deep Agents: `init`, `deploy`, `agents`, and `mcp-servers`. Bare invocations print a deprecation notice and exit non-zero. As of `deepagents-cli==0.1.0` the interactive Textual REPL has moved to the [`deepagents-cod...
178
5,627
deepagents
libs/cli/deepagents_cli/model_config.py
.py
"""Prefixed environment variable resolution for the deploy CLI. Reads `LANGSMITH_*` / `LANGCHAIN_*` env vars (and any other canonical name the deploy pipeline needs) with a `DEEPAGENTS_CLI_` prefix override. """ from __future__ import annotations import logging import os logger = logging.getLogger(__name__) _ENV_P...
56
1,987
deepagents
libs/cli/deepagents_cli/_version.py
.py
"""Version information and lightweight constants for `deepagents-cli`.""" # Keep the `x-release-please-version` annotation — release-please uses it to # bump `__version__` in sync with `pyproject.toml` on every release PR. __version__ = "0.2.2" # x-release-please-version DOCS_URL = "https://docs.langchain.com/oss/py...
27
969
deepagents
libs/cli/deepagents_cli/__main__.py
.py
"""Allow running the CLI as `python -m deepagents_cli`.""" from deepagents_cli.main import cli_main if __name__ == "__main__": cli_main()
7
144
deepagents
libs/cli/deepagents_cli/__init__.py
.py
"""Deep Agents CLI - deployment tooling (`init`, `dev`, `deploy`). For the interactive coding agent, install the `deepagents-code` package. """ from __future__ import annotations from typing import TYPE_CHECKING from deepagents_cli._version import __version__ if TYPE_CHECKING: from collections.abc import Calla...
39
979
deepagents
libs/cli/deepagents_cli/config.py
.py
"""Project and global `.env` loading for the deploy CLI.""" from __future__ import annotations import logging import os import sys from pathlib import Path logger = logging.getLogger(__name__) _PROJECT_DOTENV_BLOCKED_ENV_KEYS = ( "LANGSMITH_ENDPOINT", "LANGCHAIN_ENDPOINT", "HTTP_PROXY", "HTTPS_PROXY"...
172
5,541
deepagents
libs/cli/deepagents_cli/deploy/state.py
.py
"""User-local deploy state persisted outside the project checkout. Tracks the managed agent ID returned by the last successful deploy so that subsequent runs of `deepagents deploy` issue `PATCH` rather than `POST`. Also caches the `{mcp_server_url → mcp_server_id}` map to skip the list-call on every deploy. State is ...
112
4,130
deepagents
libs/cli/deepagents_cli/deploy/__init__.py
.py
"""Deploy commands for the Managed Deep Agents (`/v1/deepagents/*`) surface.""" from deepagents_cli.deploy.commands import ( execute_agents_command, execute_deploy_command, execute_init_command, execute_mcp_servers_command, setup_deploy_parsers, ) __all__ = [ "execute_agents_command", "exe...
18
435
deepagents
libs/cli/deepagents_cli/deploy/payload.py
.py
"""Build agent payloads and managed directory entries for deployment. This is a pure function over `Project`; no I/O happens here. The result is suitable for `ApiClient.create_agent`, `ApiClient.patch_agent`, and the Hub directory commit API. """ from __future__ import annotations import json from collections.abc im...
157
5,373
deepagents
libs/cli/deepagents_cli/deploy/project.py
.py
"""Parse a Managed Deep Agents project directory into a structured value. Layout (canonical, all paths relative to the project root): agent.json required — top-level config AGENTS.md required — system prompt tools.json optional — verbatim ToolsConfig skills/<nam...
609
21,252
deepagents
libs/cli/deepagents_cli/deploy/commands.py
.py
"""CLI commands for `deepagents init`, `deploy`, `agents`, and `mcp-servers`. Wired into the root argparse subparsers by `setup_deploy_parsers` (called from `deepagents_cli.main`). Each top-level command has an `execute_*_command` entrypoint that the main module dispatches. """ from __future__ import annotations imp...
1,076
36,189
deepagents
libs/cli/deepagents_cli/deploy/mcp_resolver.py
.py
"""Resolve MCP server URLs in a payload to workspace-registered server IDs. The deploy command does not auto-create MCP servers. Instead it validates that every `mcp_server_url` the payload references already exists at the `/v1/deepagents/mcp-servers` endpoint, and surfaces a friendly hint if not. """ from __future__...
123
4,371
deepagents
libs/cli/deepagents_cli/deploy/api_client.py
.py
"""HTTP client for the Managed Deep Agents `/v1/deepagents/*` surface. Thin wrapper around `httpx.Client` that: - Resolves auth from `LANGSMITH_API_KEY` (preferred) or `LANGCHAIN_API_KEY` and sends it as `X-Api-Key`. - Resolves the endpoint from `LANGSMITH_ENDPOINT` / `LANGCHAIN_ENDPOINT`, defaulting to `https://...
359
12,345
deepagents
libs/cli/tests/unit_tests/test_version.py
.py
"""Tests for version-related functionality.""" from __future__ import annotations import subprocess import sys import tomllib from pathlib import Path from deepagents_cli._version import __version__ def test_version_matches_pyproject() -> None: """`__version__` in `_version.py` must match the version in `pypro...
50
1,515
deepagents
libs/cli/tests/unit_tests/conftest.py
.py
"""Shared fixtures for CLI unit tests.""" from __future__ import annotations import pytest @pytest.fixture(autouse=True) def _clear_langsmith_env(monkeypatch: pytest.MonkeyPatch) -> None: """Prevent LangSmith env vars loaded from `.env` from leaking into tests. `dotenv.load_dotenv()` may inject `LANGSMITH_...
33
1,096
deepagents
libs/cli/tests/unit_tests/deploy/test_mcp_servers_command.py
.py
"""Tests for `deepagents mcp-servers {list,add,get,update,delete}`.""" from __future__ import annotations import argparse import json import webbrowser from collections.abc import Callable from typing import cast import httpx import pytest import deepagents_cli.config as config_module import deepagents_cli.deploy.a...
732
23,427
deepagents
libs/cli/tests/unit_tests/deploy/test_init_command.py
.py
"""Tests for `deepagents init`.""" from __future__ import annotations import argparse import json from typing import TYPE_CHECKING import pytest from deepagents_cli.deploy.commands import execute_init_command if TYPE_CHECKING: from pathlib import Path def _ns(name: str | None, *, force: bool = False) -> argp...
101
3,384
deepagents
libs/cli/tests/unit_tests/deploy/test_config.py
.py
"""Tests for deploy CLI dotenv loading.""" from __future__ import annotations import os from typing import TYPE_CHECKING import deepagents_cli.config as config_module from deepagents_cli.config import _load_dotenv if TYPE_CHECKING: from pathlib import Path import pytest def test_project_dotenv_loads_api_...
90
2,986
deepagents
libs/cli/tests/unit_tests/deploy/test_project.py
.py
"""Tests for Project.load().""" from __future__ import annotations import json from pathlib import Path import pytest from deepagents_cli.deploy.project import Project, ProjectError _FIXTURES = Path(__file__).parent / "fixtures" / "projects" def _write_minimal_project(root: Path) -> None: (root / "agent.json...
566
19,090
deepagents
libs/cli/tests/unit_tests/deploy/test_agents_command.py
.py
"""Tests for `deepagents agents {list,get,delete}`.""" from __future__ import annotations import argparse import json from collections.abc import Callable from typing import TYPE_CHECKING import httpx import deepagents_cli.config as config_module import deepagents_cli.deploy.api_client as api_client_module from dee...
123
3,495
deepagents
libs/cli/tests/unit_tests/deploy/test_mcp_resolver.py
.py
"""Tests for resolve_referenced_servers.""" from __future__ import annotations import httpx import pytest from deepagents_cli.deploy.api_client import ApiClient from deepagents_cli.deploy.mcp_resolver import ( UninvokableServersError, UnresolvedServersError, resolve_referenced_servers, ) def _client(mo...
119
3,886
deepagents
libs/cli/tests/unit_tests/deploy/test_api_client.py
.py
"""Tests for the /v1/deepagents/* HTTP client.""" from __future__ import annotations import json from collections.abc import Callable import httpx import pytest from deepagents_cli.deploy.api_client import ApiClient, ApiError Handler = Callable[[httpx.Request], httpx.Response] def _transport(handler: Handler) ->...
447
16,159
deepagents
libs/cli/tests/unit_tests/deploy/test_payload.py
.py
"""Snapshot tests for build_payload over fixture projects.""" from __future__ import annotations import json from pathlib import Path import pytest from deepagents_cli.deploy.payload import ( build_directory_delta, build_directory_files, build_metadata_payload, build_payload, ) from deepagents_cli.d...
149
4,886
deepagents
libs/cli/tests/unit_tests/deploy/test_deploy_command.py
.py
"""End-to-end tests for `deepagents deploy` against a mocked HTTP transport.""" from __future__ import annotations import argparse import json from collections.abc import Callable from typing import TYPE_CHECKING import httpx import pytest import deepagents_cli.deploy.api_client as api_client_module import deepagen...
443
14,527
deepagents
libs/cli/tests/unit_tests/deploy/test_state.py
.py
"""Tests for user-local deploy state.""" from __future__ import annotations import json from typing import TYPE_CHECKING import pytest import deepagents_cli.deploy.state as state_module from deepagents_cli.deploy.state import State if TYPE_CHECKING: from pathlib import Path @pytest.fixture(autouse=True) def ...
85
3,145
deepagents
libs/cli/scripts/check_imports.py
.py
"""Check imports script. Quickly verify that a list of Python files can be loaded by the Python interpreter without raising any errors. Ran before running more expensive tests. Useful in Makefiles. If loading a file fails, the script prints the problematic filename and the detailed error traceback. """ import random...
33
881
deepagents
libs/cli/examples/skills/skill-creator/scripts/quick_validate.py
.py
#!/usr/bin/env python3 """Quick validation script for skills - minimal version. For deepagents CLI, skills are located at: ~/.deepagents/<agent>/skills/<skill-name>/ Example: ```python python quick_validate.py ~/.deepagents/agent/skills/my-skill ``` """ import re import sys from pathlib import Path import yaml de...
153
4,818
deepagents
libs/cli/examples/skills/skill-creator/scripts/init_skill.py
.py
#!/usr/bin/env python3 """Skill Initializer - Creates a new skill from template. Usage: init_skill.py <skill-name> --path <path> Examples: init_skill.py my-new-skill --path skills/public init_skill.py my-api-helper --path skills/private init_skill.py custom-skill --path /custom/location For deepagents CLI: init...
315
11,092
deepagents
libs/evals/deepagents_harbor/langsmith.py
.py
"""LangSmith integration for Harbor: datasets, experiments, and feedback. Provides functions for: - Creating deterministic example IDs from task instructions - Creating and ensuring LangSmith datasets from Harbor tasks - Creating experiment sessions - Adding reward feedback from Harbor job results to LangSmith traces...
717
24,619
deepagents
libs/evals/deepagents_harbor/stats.py
.py
"""Statistical utilities for eval score reporting. Provides Wilson score confidence intervals and minimum detectable effect estimation, as recommended by Anthropic's infrastructure noise research. """ from __future__ import annotations import math def wilson_ci( successes: int, total: int, *, z: fl...
95
3,099
deepagents
libs/evals/deepagents_harbor/__init__.py
.py
"""Evaluation helpers for Deep Agents Harbor and LangSmith runs.""" from deepagents_harbor.failure import FailureCategory from deepagents_harbor.langsmith import ( add_feedback, create_dataset, create_example_id_from_instruction, create_experiment, ensure_dataset, ) __all__ = [ "FailureCategor...
20
457
deepagents
libs/evals/deepagents_harbor/failure.py
.py
"""Failure classification for eval trial results. Categorizes failures as infrastructure (OOM, timeout, sandbox) vs. model capability using exit codes and text pattern matching. """ from __future__ import annotations import json import logging import re from enum import Enum from typing import Any logger = logging....
226
6,899
deepagents
libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py
.py
"""LangGraph entrypoint for running Deep Agents under Harbor.""" from __future__ import annotations import hashlib import importlib.util import logging import os import re import uuid from contextlib import contextmanager from pathlib import Path from typing import TYPE_CHECKING, Any, cast from deepagents import cre...
554
22,764
deepagents
libs/evals/harbor_adapters/contextbench/main.py
.py
"""CLI driver for generating Context-Bench Harbor tasks by id. Run as `python -m harbor_adapters.contextbench.main`. """ from __future__ import annotations import argparse from pathlib import Path from harbor_adapters.contextbench import adapter _DEFAULT_SUITE = "cloud" def _build_parser() -> argparse.ArgumentPa...
131
4,241
deepagents
libs/evals/harbor_adapters/contextbench/adapter.py
.py
"""Generate Harbor tasks from Context-Bench filesystem records.""" from __future__ import annotations import json import re import shlex import shutil from pathlib import Path _TASK_ID_RE = re.compile(r"^cb-(?P<suite>[a-z0-9]+)-(?P<index>\d+)$") def vendor_dir() -> Path: """Return the directory containing vend...
348
14,270
deepagents
libs/evals/harbor_adapters/contextbench/templates/judge.py
.py
"""In-sandbox reimplementation of Letta letta-evals' ``RubricGrader``. Reproduces the upstream ``model_judge`` grader (`letta_evals/graders/rubric.py`, OpenAI provider) for one Context-Bench task, so our score matches upstream's grading rather than a string comparison: * the judge prompt is the upstream rubric (``/te...
163
6,017
deepagents
libs/evals/harbor_adapters/drbench/main.py
.py
"""CLI driver for generating DRBench Harbor tasks by id. Run as `python -m harbor_adapters.drbench.main`. """ from __future__ import annotations import argparse from pathlib import Path from harbor_adapters.drbench import adapter def _build_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser...
203
6,966
deepagents
libs/evals/harbor_adapters/drbench/adapter.py
.py
"""Generate Harbor tasks from DRBench enterprise deep-research records. DRBench ships each task as a company/persona profile, a deep-research question, a manifest of enterprise documents spread across four apps, and a set of ground-truth insights. This adapter targets DRBench's *app* mode: each task runs upstream's pe...
1,267
51,024
deepagents
libs/evals/harbor_adapters/drbench/templates/extract_text.py
.py
"""Convert a DRBench corpus document to plain text on stdout. Installed in the task image as `extract-text`. DRBench's corpus is PDF, DOCX, XLSX, PPTX, and JSONL mailbox exports; the benchmark scores research and synthesis rather than container-format parsing, so the task provides the same extraction path upstream's o...
238
8,415
deepagents
libs/evals/harbor_adapters/drbench/templates/judge.py
.py
#!/usr/bin/env python3 """Score a DRBench report with upstream DRBench's own metrics. Runs in the SEPARATE verifier environment built from this task's ``tests/`` directory, where ``drbench`` is pip-installed (see ``Dockerfile``). Upstream supplies the metrics, their prompts, the ground truth, and the document corpus, ...
777
34,645
deepagents
libs/evals/deepagents_clbench/system/__init__.py
.py
"""Deep Agents continual-learning system (deployed into clbench src/systems/deepagents/).""" from .system import DeepAgentsSystem __all__ = ["DeepAgentsSystem"]
6
163
deepagents
libs/evals/deepagents_clbench/system/system.py
.py
"""Deep Agents system adapter for continual-learning-bench. Wraps a LangChain Deep Agent (`deepagents`) as a :class:`ContinualLearningSystem`, using the agent's **own** memory mechanism as the continual-learning substrate: * `MemoryMiddleware` (enabled via `create_deep_agent(memory=...)`) loads `/memory/AGENTS.md...
249
9,586
deepagents
libs/evals/tests/unit_tests/test_imports.py
.py
"""Placeholder unit tests for imports here.""" def test_placeholder() -> None: """A placeholder test to ensure the test suite runs."""
6
141
deepagents
libs/evals/tests/unit_tests/test_llm_judge.py
.py
from __future__ import annotations from contextvars import ContextVar from threading import Lock from typing import TYPE_CHECKING from langchain_core.messages import AIMessage from tests.evals import llm_judge as llm_judge_module from tests.evals.llm_judge import LLMJudge from tests.evals.utils import AgentStep, Age...
53
1,747
deepagents
libs/evals/tests/unit_tests/test_generate_radar_script.py
.py
from __future__ import annotations import json import subprocess import sys from pathlib import Path _EVALS_DIR = Path(__file__).resolve().parents[2] _SCRIPT = _EVALS_DIR / "scripts" / "generate_radar.py" def _run_generate_radar(*args: str) -> subprocess.CompletedProcess[str]: return subprocess.run( [sy...
90
2,526
deepagents
libs/evals/tests/unit_tests/test_analyze_eval_failures.py
.py
"""Tests for the eval failure analysis script (`.github/scripts/evals/analyze_eval_failures.py`). Adds the script directory to `sys.path` for import since it lives outside the package tree. """ from __future__ import annotations import json import sys from pathlib import Path from unittest.mock import AsyncMock, pat...
207
7,887
deepagents
libs/evals/tests/unit_tests/test_analyze.py
.py
"""Tests for the trial analysis script (`scripts/analyze.py`). The script lives outside any importable package, so it is loaded by path. These tests pin the I/O-reuse refactor: that helpers tolerate missing/corrupt inputs without crashing, that the task-dir index is first-match and cached, and that a malformed traject...
254
9,836
deepagents
libs/evals/tests/unit_tests/test_external_benchmark_helpers.py
.py
from __future__ import annotations from langchain_core.messages import AIMessage from tests.evals.external_benchmarks import ( _fix_bfcl_gt_call, _NormalizedSubstringsPresent, ) from tests.evals.utils import AgentStep, AgentTrajectory def _make_trajectory(answer: str) -> AgentTrajectory: """Build a mini...
104
4,063
deepagents
libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py
.py
"""Tests for running Deep Agents through Harbor's built-in LangGraph agent.""" from __future__ import annotations import asyncio import hashlib import json from pathlib import Path from typing import TYPE_CHECKING import pytest from deepagents_code.config import settings from deepagents_harbor.langgraph_project imp...
894
31,762
deepagents
libs/evals/tests/unit_tests/test_drbench_judge.py
.py
"""Tests for the DRBench verifier templates (`judge.py`, `extract_text.py`). The templates run inside the Harbor sandbox with no `deepagents_evals` on the path, so they are loaded here by file path rather than imported as package modules. `judge.py` now delegates all scoring to upstream `drbench`, which is installed ...
1,309
52,543
deepagents
libs/evals/tests/unit_tests/test_run_trials.py
.py
"""Tests for the multi-trial eval runner aggregator.""" from __future__ import annotations import argparse import importlib.util import json import statistics import sys from pathlib import Path from typing import TYPE_CHECKING, Any import pytest if TYPE_CHECKING: from types import ModuleType _SCRIPT = Path(__...
673
24,949
deepagents
libs/evals/tests/unit_tests/test_trajectory.py
.py
"""Tests for AgentTrajectory.pretty() serialization. Ensures tool-call steps are always visible in the serialised output so that downstream consumers (e.g. the LLM judge) see the full trajectory. """ from __future__ import annotations from langchain_core.messages import AIMessage from tests.evals.utils import Agent...
111
3,595
deepagents
libs/evals/tests/unit_tests/test_category_tagging.py
.py
from __future__ import annotations import ast import json from pathlib import Path import pytest from deepagents_evals.radar import ( ALL_CATEGORIES, CATEGORY_LABELS, EVAL_CATEGORIES, load_results_from_summary, ) from tests.evals.pytest_reporter import _CATEGORY_RESULTS # ---------------------------...
259
9,330
deepagents
libs/evals/tests/unit_tests/test_conftest_model_required.py
.py
"""End-to-end tests for the eval suite's `--model` requirement and report-skip behaviour. These spin up an isolated pytest invocation via `pytester` to exercise the real `pytest_configure` and `pytest_sessionfinish` hooks in `tests/evals/conftest.py` and `tests/evals/pytest_reporter.py`. """ from __future__ import an...
89
3,318
deepagents
libs/evals/tests/unit_tests/test_drbench_main.py
.py
"""Tests for the DRBench Harbor task generator CLI.""" from __future__ import annotations import json from typing import TYPE_CHECKING import pytest from harbor_adapters.drbench import adapter from harbor_adapters.drbench.main import main if TYPE_CHECKING: from pathlib import Path # Every test in this module ...
183
6,814
deepagents
libs/evals/tests/unit_tests/test_assertions.py
.py
"""Deterministic unit tests for the tool-call trajectory assertions. Covers the `ToolNotCalled` hard-fail assertion (the negation of `ToolCall`) and the shared construction-time validation on both `ToolCall` and `ToolNotCalled`. These run without a model against hand-built `AgentTrajectory` objects, mirroring `test_ex...
228
9,147
deepagents
libs/evals/tests/unit_tests/test_radar.py
.py
from __future__ import annotations import importlib import json import pytest import deepagents_evals.radar as radar_module from deepagents_evals.radar import ( ALL_CATEGORIES, CATEGORY_LABELS, EVAL_CATEGORIES, ModelResult, _safe_filename, _short_model_name, generate_individual_radars, ...
242
7,483
deepagents
libs/evals/tests/unit_tests/test_model_groups.py
.py
"""Drift test: `MODEL_GROUPS.md` must match the canonical model registry.""" from __future__ import annotations import subprocess import sys from pathlib import Path _EVALS_DIR = Path(__file__).resolve().parents[2] _SCRIPT = _EVALS_DIR / "scripts" / "generate_model_groups.py" def test_model_groups_up_to_date() -> ...
30
824
deepagents
libs/evals/tests/unit_tests/test_goal_tools_contract.py
.py
"""Contract guard binding goal-tool eval gates to middleware reality.""" from deepagents_code.goal_tools import GOAL_TOOL_NAMES, GoalToolsMiddleware def test_gated_goal_tool_names_match_middleware() -> None: actual = frozenset(tool.name for tool in GoalToolsMiddleware().tools) assert actual == GOAL_TOOL_NAME...
9
322
deepagents
libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py
.py
"""Static checks for Harbor LangSmith plugin integration.""" from __future__ import annotations import tomllib from pathlib import Path from deepagents_evals.tau3_subset import DATASET, INCLUDE_TASKS, TASKS ROOT = Path(__file__).parents[4] EVALS = ROOT / "libs" / "evals" def test_evals_uses_published_harbor_langs...
275
12,805
deepagents
libs/evals/tests/unit_tests/test_pytest_reporter.py
.py
"""Tests for the eval pytest reporter plugin — specifically the _FAILURES capture.""" from __future__ import annotations from dataclasses import dataclass, field from types import SimpleNamespace from typing import TYPE_CHECKING, Any import pytest from _pytest.outcomes import Exit import tests.evals.pytest_reporter...
387
14,718
deepagents
libs/evals/tests/unit_tests/test_drbench_adapter.py
.py
"""Tests for the DRBench Harbor task adapter (app mode).""" from __future__ import annotations import json import re import tomllib from typing import TYPE_CHECKING import pytest import yaml from harbor.models.task.config import NetworkMode, TaskConfig, VerifierEnvironmentMode from harbor.models.task.verifier_mode i...
767
32,490
deepagents
libs/evals/tests/unit_tests/test_contextbench_adapter.py
.py
"""Tests for the Context-Bench Harbor task adapter.""" from __future__ import annotations import json from typing import TYPE_CHECKING from harbor_adapters.contextbench.adapter import generate_task if TYPE_CHECKING: from pathlib import Path def test_generate_task_creates_self_contained_harbor_task(tmp_path: P...
114
4,447
deepagents
libs/evals/tests/unit_tests/test_trial_summary.py
.py
"""Unit tests for `deepagents_evals.trial_summary`.""" from __future__ import annotations from deepagents_evals.trial_summary import render_per_trial_category_matrix class TestRenderPerTrialCategoryMatrix: """The matrix renders one row per trial and one column per category.""" def test_returns_empty_when_n...
96
4,385
deepagents
libs/evals/tests/unit_tests/test_cli.py
.py
"""Tests for the unified `deepagents-evals` CLI.""" from __future__ import annotations import json import subprocess from typing import TYPE_CHECKING import pytest from deepagents_evals import cli if TYPE_CHECKING: from pathlib import Path @pytest.fixture(autouse=True) def _clear_model_env(monkeypatch: pytes...
408
14,305
deepagents
libs/evals/tests/unit_tests/test_langsmith.py
.py
"""Tests for LangSmith feedback helpers.""" from __future__ import annotations import json import re from typing import TYPE_CHECKING, Any import pytest from deepagents_harbor.langsmith import ( _dataset_ref, _download_dataset, _extract_reward, _headers, _process_trial, add_feedback, res...
462
16,775
deepagents
libs/evals/tests/unit_tests/test_eval_catalog.py
.py
"""Drift test: `EVAL_CATALOG.md` must match the eval test files on disk.""" from __future__ import annotations import subprocess import sys from pathlib import Path _EVALS_DIR = Path(__file__).resolve().parents[2] _SCRIPT = _EVALS_DIR / "scripts" / "generate_eval_catalog.py" def test_eval_catalog_up_to_date() -> N...
30
809
deepagents
libs/evals/tests/unit_tests/test_contextbench_main.py
.py
"""Tests for the Context-Bench Harbor task generator CLI.""" from __future__ import annotations import json from pathlib import Path from typing import TYPE_CHECKING from harbor_adapters.contextbench import adapter from harbor_adapters.contextbench.main import main if TYPE_CHECKING: import pytest _FIXTURE_RECO...
226
8,037
deepagents
libs/evals/tests/evals/test_file_operations.py
.py
"""Eval tests for file operations and tool efficiency. Tests whether the agent can correctly use the built-in file tool surface (read, write, edit, ls, grep, glob) including parallel invocation, pagination recovery for large files, and avoiding unnecessary tool calls. Written internally for the deepagents eval suite....
941
35,304
deepagents
libs/evals/tests/evals/pytest_reporter.py
.py
from __future__ import annotations import json import logging import os import statistics import sys from datetime import UTC, datetime from importlib.metadata import version as pkg_version from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: import pytest from deepagents._version import _...
438
17,238
deepagents
libs/evals/tests/evals/utils.py
.py
from __future__ import annotations import logging import uuid from collections.abc import Callable, Mapping, Sequence from dataclasses import dataclass from typing import TYPE_CHECKING, Any import pytest from deepagents.backends.utils import create_file_data, file_data_to_string from langchain_core.messages import AI...
1,545
50,576
deepagents
libs/evals/tests/evals/test_langchain_middleware_todo.py
.py
"""Eval tests for `langchain`'s `TodoListMiddleware` against bare `create_agent`. These tests probe the behavioral properties of `WRITE_TODOS_SYSTEM_PROMPT` and `WRITE_TODOS_TOOL_DESCRIPTION` directly — using `create_agent` + `TodoListMiddleware` (not `create_deep_agent`) — so they exercise the prompt content that shi...
383
13,429
deepagents
libs/evals/tests/evals/test_skills.py
.py
"""Unit tests for skill discovery and execution. Verifies that the agent can discover skill files via configured skill paths, read SKILL.md content, select the correct skill by name, combine information from multiple skills, and edit skill files. These are SDK integration tests, not model capability evals. """ from ...
312
11,851
deepagents
libs/evals/tests/evals/test_system_prompt.py
.py
"""Unit test for system prompt passthrough. Verifies that a custom system prompt provided via create_deep_agent is reflected in the agent's response. This is an SDK integration test, not a model capability eval. """ from __future__ import annotations from typing import TYPE_CHECKING import pytest from deepagents im...
42
1,226
deepagents
libs/evals/tests/evals/test_subagents.py
.py
"""Unit tests for subagent delegation via the task tool. Verifies that the agent can delegate to named subagents and the general-purpose subagent via the task tool. These are SDK integration tests, not model capability evals. """ from __future__ import annotations from typing import TYPE_CHECKING import pytest fro...
105
3,176
deepagents
libs/evals/tests/evals/external_benchmarks.py
.py
from __future__ import annotations import contextlib import copy import inspect import json import re import uuid from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Any import pytest from deepagents import create_deep_agent from langchain_core.tools import StructuredTool from...
359
12,591
deepagents
libs/evals/tests/evals/test_tool_selection.py
.py
"""Eval tests for tool selection behavior. Tests whether the agent selects the correct tool(s) from a set of available tools given direct, indirect, and multi-step user requests. Ported from the agent-builder-graphs tool-discovery eval suite and adapted for deepagents. The agent is given a pool of mock tools and a us...
334
10,579
deepagents
libs/evals/tests/evals/test_memory_multiturn.py
.py
"""Eval tests for multi-turn memory behavior. Tests whether the agent: 1. Picks up on implicit user preferences revealed through conversation (not explicit "remember this" instructions). 2. Records explicit user instructions given during multi-turn exchanges. 3. Does NOT persist transient or one-off information fr...
275
10,314
deepagents
libs/evals/tests/evals/test_summarization.py
.py
"""Eval tests for context overflow and summarization behavior. Tests whether the agent handles large files that exceed the context window by triggering summarization middleware, offloading conversation history to the filesystem, recovering information via needle-in-the-haystack follow-ups, and using the compact_conver...
285
10,757
deepagents
libs/evals/tests/evals/test_tool_usage_incident_graph.py
.py
"""Eval tests for incident-management graph tool usage. A synthetic operational incident-management domain with many entities and tools. The agent receives only graph lookup/search tools and must compose them to answer questions efficiently. """ from __future__ import annotations from typing import TYPE_CHECKING, An...
1,571
52,239
deepagents
libs/evals/tests/evals/test_todos.py
.py
"""Eval tests for stateful sequential tool use. Tests whether the agent can create and incrementally update a todo list across multiple sequential tool calls, maintaining correct state at each step. Written internally for the deepagents eval suite. """ from __future__ import annotations from typing import TYPE_CHEC...
75
2,915