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
openai-agents-python
tests/test_tracing_errors.py
.py
from __future__ import annotations import json from typing import Any, cast import pytest from inline_snapshot import snapshot from typing_extensions import TypedDict from agents import ( Agent, GuardrailFunctionOutput, InputGuardrail, InputGuardrailTripwireTriggered, MaxTurnsExceeded, ModelB...
776
26,341
openai-agents-python
tests/test_error_logging_redaction.py
.py
"""Error-path logging must not leak model/tool payloads when data logging is disabled. The exception attached to a ``SpanError`` is already redacted based on the tracing flag, but the sibling ``logger.error`` calls used to log the raw exception (and, for tool actions, the full traceback) unconditionally. These tests l...
2,831
100,536
openai-agents-python
tests/test_handoff_prompt.py
.py
from agents.extensions.handoff_prompt import ( RECOMMENDED_PROMPT_PREFIX, prompt_with_handoff_instructions, ) def test_prompt_with_handoff_instructions_includes_prefix() -> None: prompt = "Handle the transfer smoothly." result = prompt_with_handoff_instructions(prompt) assert result.startswith(RE...
13
380
openai-agents-python
tests/test_computer_action.py
.py
"""Unit tests for the ComputerAction methods in `agents.run_internal.run_loop`. These confirm that the correct computer action method is invoked for each action type and that screenshots are taken and wrapped appropriately, and that the execute function invokes hooks and returns the expected ToolCallOutputItem.""" im...
787
28,112
openai-agents-python
tests/test_run_internal_error_handlers.py
.py
from __future__ import annotations import json from typing import Any import pytest from agents import Agent from agents.agent_output import AgentOutputSchemaBase from agents.exceptions import MaxTurnsExceeded, UserError from agents.run_context import RunContextWrapper from agents.run_error_handlers import RunErrorD...
124
3,970
openai-agents-python
tests/test_local_shell_tool.py
.py
"""Tests for local shell tool execution. These confirm that LocalShellAction.execute forwards the command to the executor and that Runner.run executes local shell calls and records their outputs. """ import json from typing import Any, cast import httpx import pytest from openai import AsyncOpenAI from openai.types....
350
11,994
openai-agents-python
tests/test_run_context_approvals.py
.py
from __future__ import annotations import pytest from openai.types.responses.response_output_item import McpApprovalRequest from agents import Agent, ModelBehaviorError, RunContextWrapper, ToolApprovalItem, UserError from .utils.factories import make_tool_approval_item def _make_hosted_mcp_approval_item( agent...
743
23,105
openai-agents-python
tests/test_tool_identity.py
.py
"""Unit tests for src/agents/_tool_identity.py pure helpers. These cover the small, pure functions in `_tool_identity` that build / parse function-tool lookup keys and trace names. The module had no direct test file even though it's imported across the runner, tracing, and tool-output trimmer code paths. """ from __f...
168
6,662
openai-agents-python
tests/test_run_state.py
.py
"""Tests for RunState serialization, approval/rejection, and state management.""" from __future__ import annotations import gc import importlib import json import logging from collections.abc import Callable, Mapping from copy import deepcopy from dataclasses import dataclass, replace from datetime import datetime fr...
12,062
474,871
openai-agents-python
tests/test_repl.py
.py
import pytest from agents import Agent, run_demo_loop from agents.testing import ScriptedModel from .test_responses import ( get_function_tool, get_function_tool_call, get_handoff_tool_call, get_text_input_item, get_text_message, ) @pytest.mark.asyncio async def test_run_demo_loop_conversation(m...
101
2,962
openai-agents-python
tests/test_programmatic_tool_calling.py
.py
from __future__ import annotations import asyncio import json import sys from collections.abc import Awaitable, Coroutine from dataclasses import dataclass from typing import Annotated, Any, Literal, cast import pytest from openai.types.responses import ( ResponseApplyPatchToolCall, ResponseCustomToolCall, ...
2,772
92,770
openai-agents-python
tests/test_tool_guardrails.py
.py
from __future__ import annotations import asyncio from typing import Any import pytest from agents import ( Agent, MaxTurnsExceeded, Runner, ToolGuardrailFunctionOutput, ToolInputGuardrail, ToolInputGuardrailData, ToolInputGuardrailTripwireTriggered, ToolOutputGuardrail, ToolOutpu...
659
23,619
openai-agents-python
tests/test_run_internal_items.py
.py
from __future__ import annotations import dataclasses import json from typing import Any, cast import pytest from openai.types.responses import ( ResponseFunctionToolCall, ResponseToolSearchCall, ResponseToolSearchOutputItem, ) from openai.types.responses.response_function_tool_call import CallerProgram f...
1,171
38,444
openai-agents-python
tests/test_tracing_provider_safe_debug.py
.py
from __future__ import annotations import io import logging from agents.logger import logger from agents.tracing.provider import _safe_debug class _CapturingHandler(logging.Handler): def __init__(self) -> None: super().__init__() self.records: list[logging.LogRecord] = [] def emit(self, rec...
39
1,037
openai-agents-python
tests/test_scripted_model.py
.py
from __future__ import annotations import asyncio from collections.abc import AsyncIterator from typing import Any, cast import httpx import pytest from openai import APIConnectionError from openai.types.responses import ( ResponseApplyPatchToolCall, ResponseCodeInterpreterToolCall, ResponseCompletedEvent...
2,239
71,277
openai-agents-python
tests/test_tool_use_behavior.py
.py
# Copyright from __future__ import annotations from typing import Any, cast import pytest from openai.types.responses.response_input_item_param import FunctionCallOutput from agents import ( Agent, FunctionToolResult, RunContextWrapper, ToolCallOutputItem, ToolsToFinalOutputResult, UserError...
264
9,208
openai-agents-python
tests/_fake_workspace_paths.py
.py
from __future__ import annotations import shlex from collections.abc import Sequence from dataclasses import dataclass from pathlib import PurePosixPath @dataclass(frozen=True) class FakeResolveWorkspaceResult: exit_code: int stdout: str = "" stderr: str = "" def resolve_fake_workspace_path( comman...
109
3,509
openai-agents-python
tests/test_cancel_streaming.py
.py
import asyncio import json import time import pytest from openai.types.responses import ResponseCompletedEvent from agents import Agent, Runner from agents.guardrail import input_guardrail from agents.stream_events import RawResponsesStreamEvent from agents.testing import ScriptedModel from .test_responses import ge...
313
10,181
openai-agents-python
tests/test_oaiconv_resume_response_id.py
.py
"""Tests for OpenAIServerConversationTracker.hydrate_from_state response_id seeding.""" from typing import Any from agents.items import ModelResponse from agents.run_internal.oai_conversation import OpenAIServerConversationTracker from agents.usage import Usage def _make_response(response_id: str | None) -> ModelRe...
45
1,518
openai-agents-python
tests/testing_processor.py
.py
from __future__ import annotations import threading from datetime import datetime from typing import Any, Literal from agents.tracing import Span, Trace, TracingProcessor TestSpanProcessorEvent = Literal["trace_start", "trace_end", "span_start", "span_end"] class SpanProcessorForTests(TracingProcessor): """ ...
183
6,646
openai-agents-python
tests/test_asyncio_progress.py
.py
from __future__ import annotations import asyncio import contextlib import pytest from agents.run_internal._asyncio_progress import get_function_tool_task_progress_deadline @pytest.mark.asyncio async def test_function_tool_task_progress_deadline_detects_timer_backed_sleep() -> None: loop = asyncio.get_running_...
197
5,248
openai-agents-python
tests/test_tool_custom_data.py
.py
from __future__ import annotations from typing import Any, cast import pytest from openai.types.responses import ResponseCustomToolCall from openai.types.responses.response_computer_tool_call import ( ActionScreenshot, ResponseComputerToolCall, ) from agents import ( Agent, ApplyPatchTool, Comput...
285
9,393
openai-agents-python
tests/test_items_helpers.py
.py
from __future__ import annotations import gc import json import weakref from typing import Any, cast import pytest from openai.types.responses.computer_action import Click as BatchedClick, Type as BatchedType from openai.types.responses.response_apply_patch_tool_call import ResponseApplyPatchToolCall from openai.type...
844
31,405
openai-agents-python
tests/test_agent_prompt.py
.py
from __future__ import annotations import asyncio from typing import Any import pytest from openai import omit from agents import Agent, Prompt, RunConfig, RunContextWrapper, Runner from agents.models.interface import Model, ModelProvider from agents.models.openai_responses import OpenAIResponsesModel from agents.pr...
222
6,558
openai-agents-python
tests/test_pretty_print.py
.py
import json import pytest from inline_snapshot import snapshot from pydantic import BaseModel from agents import Agent, RunContextWrapper, RunErrorDetails, Runner, RunResult from agents.agent_output import _WRAPPER_DICT_KEY from agents.testing import ScriptedModel from agents.util._pretty_print import ( pretty_pr...
259
6,804
openai-agents-python
tests/test_runtime_symmetry_contract.py
.py
from __future__ import annotations from typing import Any import pytest from openai.types.responses.response_usage import InputTokensDetails, OutputTokensDetails from agents import Agent, Runner, Tool, Usage from agents.items import ToolApprovalItem from agents.result import RunResult, RunResultStreaming from agents...
216
7,819
openai-agents-python
tests/test_check_optional_truthiness.py
.py
from __future__ import annotations import importlib.util import sys from pathlib import Path from types import ModuleType from typing import Any, cast import pytest def _load_checker() -> ModuleType: path = Path(__file__).parents[1] / ".github/scripts/check_optional_truthiness.py" spec = importlib.util.spec...
832
19,451
openai-agents-python
tests/test_guardrails.py
.py
from __future__ import annotations import asyncio import time from typing import Any from unittest.mock import patch import pytest from agents import ( Agent, GuardrailFunctionOutput, InputGuardrail, InputGuardrailTripwireTriggered, OutputGuardrail, OutputGuardrailTripwireTriggered, RunCo...
2,271
81,941
openai-agents-python
tests/test_max_turns.py
.py
from __future__ import annotations import asyncio import json from typing import Any, Literal import pytest from pydantic import BaseModel from typing_extensions import TypedDict from agents import ( Agent, GuardrailFunctionOutput, ItemHelpers, MaxTurnsExceeded, MessageOutputItem, ModelRefusa...
1,044
34,468
openai-agents-python
tests/test_decorators.py
.py
import types from typing import Any from typing_extensions import assert_type import agents.decorators as decorators_module import agents.tool as tool_module from agents import ( FunctionTool, ToolGuardrailFunctionOutput, function_tool, input_guardrail, output_guardrail, tool_input_guardrail, ...
78
2,861
openai-agents-python
tests/test_computer_tool_lifecycle.py
.py
from __future__ import annotations import asyncio import logging from typing import Any, cast from unittest.mock import AsyncMock import pytest from openai.types.responses import ResponseOutputMessage, ResponseOutputText from openai.types.responses.response_computer_tool_call import ( ActionScreenshot, Respon...
350
11,160
openai-agents-python
tests/test_tool_converter.py
.py
import pytest from pydantic import BaseModel from agents import Agent, Handoff, function_tool, handoff, tool_namespace from agents.exceptions import UserError from agents.models.chatcmpl_converter import Converter from agents.tool import FileSearchTool, WebSearchTool def some_function(a: str, b: list[int]) -> str: ...
83
2,610
openai-agents-python
tests/test_run_context_wrapper.py
.py
from typing import Any from agents.items import ToolApprovalItem from agents.run_context import RunContextWrapper from tests.utils.hitl import make_agent class BrokenStr: def __str__(self) -> str: raise RuntimeError("broken") class FalsyToolApprovalItem(ToolApprovalItem): def __bool__(self) -> bool...
309
10,640
openai-agents-python
tests/test_function_schema.py
.py
from collections.abc import Callable, Mapping from enum import Enum from typing import Annotated, Any, Literal import pytest from pydantic import BaseModel, Field, ValidationError from pydantic.json_schema import PydanticJsonSchemaWarning from typing_extensions import TypedDict from agents import RunContextWrapper, f...
1,140
41,286
openai-agents-python
tests/test_usaspending_setup_db.py
.py
from __future__ import annotations import importlib import ssl import sys import types import urllib.request from pathlib import Path from typing import Any from examples.sandbox.extensions.daytona.usaspending_text2sql import setup_db def test_paths_use_examples_artifacts_dir_when_set(monkeypatch: Any, tmp_path: Pa...
88
2,924
openai-agents-python
tests/test_handoff_tool.py
.py
import asyncio import dataclasses import inspect import json import logging from typing import Any, cast import pytest from openai.types.responses import ResponseOutputMessage, ResponseOutputText from pydantic import BaseModel import agents._debug as _debug from agents import ( Agent, Handoff, HandoffInpu...
721
23,532
openai-agents-python
tests/test_run_step_execution.py
.py
from __future__ import annotations import asyncio import copy import dataclasses import gc import json from collections.abc import Callable from contextvars import ContextVar from dataclasses import dataclass from typing import Any, cast import pytest from openai.types.responses import ResponseFunctionToolCall from o...
4,630
154,984
openai-agents-python
tests/test_call_model_input_filter.py
.py
from __future__ import annotations from typing import Any, cast import pytest from agents import Agent, RunConfig, Runner, TResponseInputItem, UserError from agents.run import CallModelData, ModelInputData from agents.testing import ScriptedModel from .test_responses import get_text_input_item, get_text_message fro...
424
12,824
openai-agents-python
tests/test_tool_name_collision_policy.py
.py
from __future__ import annotations import asyncio from dataclasses import replace from typing import Any, cast import pytest from openai.types.responses import ResponseFunctionToolCall from openai.types.responses.response_function_tool_call import CallerProgram from openai.types.responses.response_output_item import ...
1,514
48,766
openai-agents-python
tests/test_responses.py
.py
from __future__ import annotations from typing import Any from openai.types.responses import ( ResponseFunctionToolCall, ResponseOutputItem, ResponseOutputMessage, ResponseOutputRefusal, ResponseOutputText, ) from agents import ( Agent, FunctionTool, Handoff, TResponseInputItem, ...
101
2,548
openai-agents-python
tests/test_tool_output_conversion.py
.py
from __future__ import annotations from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall from agents import ItemHelpers, ToolOutputFileContent, ToolOutputImage, ToolOutputText def _make_tool_call() -> ResponseFunctionToolCall: return ResponseFunctionToolCall( id="call-1...
407
16,782
openai-agents-python
tests/test_tracing_errors_streamed.py
.py
from __future__ import annotations import asyncio import json from typing import Any import pytest from inline_snapshot import snapshot from typing_extensions import TypedDict from agents import ( Agent, AgentsException, GuardrailFunctionOutput, InputGuardrail, InputGuardrailTripwireTriggered, ...
682
22,800
openai-agents-python
tests/test_stream_events.py
.py
import asyncio import time from copy import deepcopy from typing import Any, cast import pytest from openai._models import construct_type from openai.types.responses import ( ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseContentPartDoneEvent, ResponseCreatedEvent, ResponseFunctionC...
744
24,318
openai-agents-python
tests/test_tool_origin.py
.py
from __future__ import annotations import gc import json import weakref from collections.abc import Sequence from typing import Any, TypeVar, cast import pytest from openai.types.responses.response_output_item import McpCall, McpListTools, McpListToolsTool from pydantic import BaseModel from agents import ( Agen...
537
17,159
openai-agents-python
tests/test_run_state_pending_input.py
.py
from __future__ import annotations import json from typing import Any, cast import pytest from openai.types.responses.response_computer_tool_call import ( ActionScreenshot, ResponseComputerToolCall, ) from agents import Agent, ComputerTool, InputItem, RunConfig, Runner, function_tool from agents.exceptions i...
968
36,608
openai-agents-python
tests/test_daytona_usaspending_example.py
.py
from __future__ import annotations import importlib from typing import Any import pytest from agents.sandbox.capabilities.memory import Memory def _load_usaspending_agent_module() -> Any: try: return importlib.import_module( "examples.sandbox.extensions.daytona.usaspending_text2sql.agent" ...
46
1,274
openai-agents-python
tests/test_agent_runner_sync.py
.py
import asyncio from collections.abc import Generator from typing import Any, Protocol import pytest from agents.agent import Agent from agents.run import AgentRunner class _EventLoopPolicy(Protocol): def get_event_loop(self) -> asyncio.AbstractEventLoop: ... def set_event_loop(self, loop: asyncio.AbstractE...
184
5,781
openai-agents-python
tests/model_test_helpers.py
.py
from __future__ import annotations import copy from collections.abc import AsyncIterator from openai.types.responses import ( Response, ResponseCompletedEvent, ResponseOutputItemDoneEvent, ResponseUsage, ) from openai.types.responses.response_usage import InputTokensDetails, OutputTokensDetails from ...
77
2,643
openai-agents-python
tests/test_agent_as_tool.py
.py
from __future__ import annotations import asyncio import contextlib import dataclasses import json from typing import Any, cast import pytest from openai.types.responses import ResponseOutputMessage, ResponseOutputText from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall from openai...
3,594
108,279
openai-agents-python
tests/test_run_serial_tests.py
.py
from __future__ import annotations import importlib.util import sys from pathlib import Path from types import ModuleType import pytest SERIAL_MARKER_SOURCE = ".".join(("pytest", "mark", "serial")) REVIEW_OPTIONAL_MARKER_SOURCE = ".".join(("pytest", "mark", "review_optional")) @pytest.fixture def serial_test_runne...
99
3,278
openai-agents-python
tests/conftest.py
.py
from __future__ import annotations import os import sys from collections.abc import MutableMapping import pytest from agents.models import _openai_shared from agents.models.openai_chatcompletions import OpenAIChatCompletionsModel from agents.models.openai_responses import OpenAIResponsesModel from agents.run import ...
120
3,858
openai-agents-python
tests/tracing/test_tracing_env_disable.py
.py
import logging import pytest import agents._debug as _debug from agents.tracing.provider import DefaultTraceProvider from agents.tracing.scope import Scope from agents.tracing.span_data import AgentSpanData from agents.tracing.spans import NoOpSpan, SpanImpl from agents.tracing.traces import NoOpTrace, TraceImpl de...
164
5,592
openai-agents-python
tests/tracing/test_import_side_effects.py
.py
from __future__ import annotations import json import os import subprocess import sys from pathlib import Path from typing import cast import pytest REPO_ROOT = Path(__file__).resolve().parents[2] SRC_ROOT = REPO_ROOT / "src" pytestmark = pytest.mark.review_optional def _run_python(script: str) -> dict[str, object...
352
10,639
openai-agents-python
tests/tracing/test_processor_api_key.py
.py
from __future__ import annotations from types import SimpleNamespace from typing import Any, cast import pytest from agents.tracing.processors import BackendSpanExporter from agents.tracing.spans import Span from agents.tracing.traces import Trace @pytest.mark.asyncio async def test_processor_api_key(monkeypatch):...
78
2,475
openai-agents-python
tests/tracing/test_traces_impl.py
.py
import asyncio import logging from collections.abc import AsyncGenerator, Callable from typing import Any, cast import pytest from agents.tracing.processor_interface import TracingProcessor from agents.tracing.scope import Scope from agents.tracing.spans import Span from agents.tracing.traces import ( NoOpTrace, ...
279
8,402
openai-agents-python
tests/tracing/test_span_ordering.py
.py
from typing import Any import pytest from agents import trace from agents.tracing import agent_span, custom_span from agents.tracing.spans import Span from tests.testing_processor import SPAN_PROCESSOR_TESTING, fetch_normalized_spans # `span_id` is caller-settable, so the same value can appear in two traces. SHARED_...
103
3,804
openai-agents-python
tests/tracing/test_spans_impl.py
.py
import asyncio from collections.abc import AsyncGenerator, Callable from typing import Any, cast import pytest from agents.tracing.processor_interface import TracingProcessor from agents.tracing.scope import Scope from agents.tracing.span_data import AgentSpanData, SpanData from agents.tracing.spans import NoOpSpan, ...
163
5,280
openai-agents-python
tests/tracing/test_setup.py
.py
from __future__ import annotations import atexit from typing import Any, cast import pytest from agents.tracing import ( processors as tracing_processors, provider as tracing_provider, setup as tracing_setup, ) class _DummyProvider: def __init__(self) -> None: self.shutdown_calls = 0 d...
119
3,844
openai-agents-python
tests/tracing/test_logger.py
.py
from agents.tracing import logger as tracing_logger def test_tracing_logger_is_configured() -> None: assert tracing_logger.logger.name == "openai.agents.tracing"
6
168
openai-agents-python
tests/tracing/test_set_api_key_fix.py
.py
import pytest from agents.tracing.processors import BackendSpanExporter def test_set_api_key_preserves_env_fallback(monkeypatch: pytest.MonkeyPatch): """Test that set_api_key doesn't break environment variable fallback.""" monkeypatch.setenv("OPENAI_API_KEY", "env-key") exporter = BackendSpanExporter() ...
24
714
openai-agents-python
tests/tracing/test_trace_context.py
.py
from __future__ import annotations import logging from uuid import uuid4 from openai.types.responses import Response import agents.tracing.traces as trace_module from agents.tracing import TracingConfig, set_tracing_disabled, trace from agents.tracing.context import TraceCtxManager, create_trace_for_run from agents....
341
10,459
openai-agents-python
tests/sandbox/test_session_sinks.py
.py
from __future__ import annotations import asyncio import io import json import tarfile import uuid from pathlib import Path from unittest.mock import MagicMock, patch import pytest from inline_snapshot import snapshot from agents.sandbox.entries import Dir, File from agents.sandbox.errors import WorkspaceReadNotFoun...
936
35,756
openai-agents-python
tests/sandbox/test_snapshot_defaults.py
.py
from __future__ import annotations import os from pathlib import Path import pytest from agents.sandbox.snapshot import LocalSnapshotSpec from agents.sandbox.snapshot_defaults import ( _DEFAULT_LOCAL_SNAPSHOT_TTL_SECONDS, cleanup_stale_default_local_snapshots, default_local_snapshot_base_dir, resolve...
182
5,317
openai-agents-python
tests/sandbox/test_mount_lifecycle.py
.py
from __future__ import annotations import asyncio from pathlib import Path from typing import Any, cast import pytest from agents.sandbox.errors import WorkspaceArchiveReadError from agents.sandbox.session.mount_lifecycle import with_ephemeral_mounts_removed class _FakeMountStrategy: def __init__( self...
365
11,258
openai-agents-python
tests/sandbox/test_client_options.py
.py
from __future__ import annotations import importlib from typing import Literal import pytest from agents.extensions.sandbox.cloudflare import CloudflareSandboxClientOptions from agents.extensions.sandbox.daytona import DaytonaSandboxClientOptions from agents.extensions.sandbox.e2b import E2BSandboxClientOptions from...
112
3,808
openai-agents-python
tests/sandbox/test_extract.py
.py
from __future__ import annotations import io import os import tarfile import zipfile from pathlib import Path import pytest from agents.sandbox import SandboxArchiveLimits from agents.sandbox.entries import GCSMount, InContainerMountStrategy, MountpointMountPattern from agents.sandbox.errors import ( InvalidComp...
858
28,500
openai-agents-python
tests/sandbox/test_parse_utils.py
.py
import pytest from agents.sandbox.files import EntryKind from agents.sandbox.types import FileMode from agents.sandbox.util.parse_utils import parse_ls_la def test_parse_ls_la_preserves_absolute_file_paths() -> None: output = "-rwxr-xr-x 1 root root 48915747 Jan 1 00:00 /workspace/bin/tool\n" entries = pars...
150
5,001
openai-agents-python
tests/sandbox/test_entries.py
.py
from __future__ import annotations import hashlib import io import os from collections.abc import Awaitable, Callable, Sequence from pathlib import Path, PureWindowsPath import pytest import agents.sandbox.entries.artifacts as artifacts_module from agents.sandbox import SandboxConcurrencyLimits, SandboxPathGrant fro...
1,082
36,770
openai-agents-python
tests/sandbox/test_tar_workspace.py
.py
from pathlib import Path from agents.sandbox.session.tar_workspace import shell_tar_exclude_args def test_shell_tar_exclude_args_skips_empty_and_dot_paths() -> None: assert shell_tar_exclude_args([Path(""), Path("."), Path("/")]) == [] def test_shell_tar_exclude_args_sorts_and_adds_plain_and_dot_prefixed_patte...
29
884
openai-agents-python
tests/sandbox/test_errors.py
.py
from __future__ import annotations from pathlib import Path from agents.sandbox.errors import ( ErrorCode, ExecTimeoutError, GitCloneError, GitCopyError, SandboxError, SnapshotPersistError, SnapshotRestoreError, WorkspaceArchiveReadError, WorkspaceReadNotFoundError, WorkspaceSt...
63
1,963
openai-agents-python
tests/sandbox/test_materialization.py
.py
from __future__ import annotations import asyncio from collections.abc import Awaitable, Callable import pytest from agents.sandbox.materialization import gather_in_order @pytest.mark.asyncio async def test_gather_in_order_limits_concurrency_and_preserves_order() -> None: active_tasks = 0 max_active_tasks ...
55
1,584
openai-agents-python
tests/sandbox/test_apply_patch.py
.py
from __future__ import annotations from pathlib import Path import pytest from agents.editor import ApplyPatchOperation from agents.sandbox import Manifest from agents.sandbox.errors import ( ApplyPatchDecodeError, ApplyPatchDiffError, ApplyPatchFileNotFoundError, ApplyPatchPathError, ) from tests.sa...
414
11,971
openai-agents-python
tests/sandbox/test_retry.py
.py
from __future__ import annotations import asyncio from typing import cast import pytest from agents.sandbox.util.retry import ( BackoffStrategy, exception_chain_contains_type, exception_chain_has_status_code, iter_exception_chain, retry_async, ) class _ErrorWithHttpMetadata(Exception): def ...
166
4,921
openai-agents-python
tests/sandbox/test_snapshot.py
.py
from __future__ import annotations import asyncio import io from pathlib import Path from typing import Literal import pytest from pydantic import PrivateAttr, ValidationError from agents.sandbox import Manifest, RemoteSnapshot, RemoteSnapshotSpec, resolve_snapshot from agents.sandbox.entries import File from agents...
824
27,866
openai-agents-python
tests/sandbox/test_pty_types.py
.py
from __future__ import annotations from agents.sandbox.session.pty_types import ( PTY_EMPTY_YIELD_TIME_MS_MIN, PTY_YIELD_TIME_MS_MIN, allocate_pty_process_id, clamp_pty_yield_time_ms, process_id_to_prune_from_meta, resolve_pty_write_yield_time_ms, ) def test_clamp_pty_yield_time_ms_enforces_m...
40
1,240
openai-agents-python
tests/sandbox/test_compatibility_guards.py
.py
from __future__ import annotations import dataclasses import uuid from collections.abc import Iterable from typing import Any, TypeVar, cast import pytest from pydantic import TypeAdapter import agents.sandbox as sandbox_package import agents.sandbox.capabilities as capabilities_package import agents.sandbox.entries...
1,092
34,482
openai-agents-python
tests/sandbox/test_workspace_payloads.py
.py
from __future__ import annotations import io from pathlib import Path from typing import Any, cast import pytest from agents.sandbox.errors import ErrorCode, WorkspaceWriteTypeError from agents.sandbox.session.workspace_payloads import coerce_write_payload class _Headers: def __init__(self, value: str | None) ...
125
3,472
openai-agents-python
tests/sandbox/test_remote_mount_policy.py
.py
from pathlib import Path from agents.sandbox.entries import BaseEntry, Dir, DockerVolumeMountStrategy, S3Mount from agents.sandbox.manifest import Manifest from agents.sandbox.remote_mount_policy import build_remote_mount_policy_instructions def _s3_mount(*, read_only: bool) -> S3Mount: return S3Mount( b...
64
2,501
openai-agents-python
tests/sandbox/test_sandboxes_import.py
.py
from __future__ import annotations import importlib import sys from types import ModuleType from typing import Any import pytest def _restore_module(name: str, original: ModuleType | None) -> None: sys.modules.pop(name, None) if original is not None: sys.modules[name] = original def _restore_attr(...
85
3,105
openai-agents-python
tests/sandbox/test_docker_network_mode.py
.py
from __future__ import annotations import ast from pathlib import Path from typing import Any, cast import docker.errors # type: ignore[import-untyped] import pytest from agents import Agent from agents.run_context import RunContextWrapper from agents.run_state import RunState from agents.sandbox.config import DEFA...
348
10,741
openai-agents-python
tests/sandbox/test_runtime.py
.py
from __future__ import annotations import asyncio import io import json import logging import os import re import shutil import sys import tarfile import tempfile import uuid from collections.abc import Sequence from pathlib import Path, PurePosixPath, PureWindowsPath from typing import Any, ClassVar, Literal, TypedDi...
6,795
230,945
openai-agents-python
tests/sandbox/test_session_utils.py
.py
from __future__ import annotations import io import os import shlex import subprocess import sys import uuid from concurrent.futures import ThreadPoolExecutor from pathlib import Path import pytest from agents.sandbox.entries import GCSMount, InContainerMountStrategy, MountpointMountPattern from agents.sandbox.error...
448
14,336
openai-agents-python
tests/sandbox/test_session_manager.py
.py
from __future__ import annotations import asyncio import logging import uuid from pathlib import Path import pytest import agents._debug as _debug from agents.sandbox.manifest import Manifest from agents.sandbox.runtime_session_manager import SandboxRuntimeSessionManager from agents.sandbox.sandboxes.unix_local impo...
312
10,002
openai-agents-python
tests/sandbox/test_mounts.py
.py
from __future__ import annotations import io import uuid from pathlib import Path import pytest from agents.sandbox import Manifest from agents.sandbox.entries import ( AzureBlobMount, BoxMount, DockerVolumeMountStrategy, FuseMountPattern, GCSMount, InContainerMountStrategy, Mount, Mo...
1,492
50,389
openai-agents-python
tests/sandbox/test_dependencies.py
.py
from __future__ import annotations import asyncio import pytest from agents.sandbox.session import ( Dependencies, DependenciesBindingError, DependenciesError, DependenciesMissingDependencyError, ) _EAGER_TASK_FACTORY = getattr(asyncio, "eager_task_factory", None) class _AsyncClosable: def __i...
449
13,197
openai-agents-python
tests/sandbox/test_token_truncation.py
.py
from __future__ import annotations from agents.sandbox.util.token_truncation import ( TruncationPolicy, approx_bytes_for_tokens, approx_token_count, approx_tokens_from_byte_count, format_truncation_marker, formatted_truncate_text, formatted_truncate_text_with_token_count, removed_units_...
135
5,307
openai-agents-python
tests/sandbox/test_session_state_roundtrip.py
.py
"""Tests for JSON round-trip safety of SandboxSessionState. Verifies that SandboxSessionState can survive serialization to JSON and deserialization back without losing subclass identity, subclass-specific fields, or the ``type`` discriminator under ``exclude_unset``. """ from __future__ import annotations import io ...
605
22,532
openai-agents-python
tests/sandbox/test_exposed_ports.py
.py
from __future__ import annotations import pytest from agents.sandbox.errors import ExposedPortUnavailableError from agents.sandbox.sandboxes import UnixLocalSandboxClient, UnixLocalSandboxClientOptions from agents.sandbox.types import ExposedPortEndpoint def test_exposed_port_endpoint_formats_urls() -> None: in...
82
2,958
openai-agents-python
tests/sandbox/test_manifest.py
.py
import asyncio import contextlib import json from pathlib import Path from typing import ClassVar, Literal import pytest from pydantic import model_serializer from pydantic_core import PydanticSerializationError from agents.sandbox.entries import ( Dir, File, GCSMount, InContainerMountStrategy, Mo...
543
17,491
openai-agents-python
tests/sandbox/test_mount_security.py
.py
from __future__ import annotations import asyncio import builtins import importlib import inspect import sys from pathlib import Path, PureWindowsPath from typing import Any, ClassVar, Literal, cast import pytest from pydantic import ConfigDict, PrivateAttr, model_serializer, model_validator from agents.extensions.s...
4,517
155,752
openai-agents-python
tests/sandbox/test_compaction.py
.py
import pytest from agents.sandbox.capabilities import CompactionModelInfo @pytest.mark.parametrize( ("model", "context_window"), [ ("gpt-5.4", 1_047_576), ("gpt-5.4-pro", 1_047_576), ("gpt-5.5", 1_047_576), ("gpt-5.5-2026-04-23", 1_047_576), ("gpt-5.5-pro", 1_047_576),...
47
1,494
openai-agents-python
tests/sandbox/test_unix_local.py
.py
from __future__ import annotations import asyncio import signal from pathlib import Path from types import SimpleNamespace from typing import cast import pytest from agents.sandbox import SandboxPathGrant from agents.sandbox.errors import PtySessionNotFoundError from agents.sandbox.manifest import Manifest from agen...
325
11,628
openai-agents-python
tests/sandbox/test_posix_tool_paths.py
.py
from __future__ import annotations import base64 import io import sys from pathlib import Path import pytest from agents.sandbox import Manifest from agents.sandbox.capabilities.tools import ViewImageArgs, ViewImageTool from agents.sandbox.capabilities.tools.shell_tool import _resolve_workdir_command from agents.tes...
74
2,237
openai-agents-python
tests/sandbox/test_runtime_helpers.py
.py
from __future__ import annotations import json import subprocess import sys from pathlib import Path, PurePosixPath import pytest from agents.sandbox.session.runtime_helpers import ( RESOLVE_WORKSPACE_PATH_HELPER, WORKSPACE_FINGERPRINT_HELPER, RuntimeHelperScript, ) requires_posix_shell = pytest.mark.sk...
246
7,351
openai-agents-python
tests/sandbox/test_run_cwd.py
.py
from __future__ import annotations import asyncio import base64 import io import shlex import sys from collections.abc import Awaitable, Callable from pathlib import Path from typing import TYPE_CHECKING, Any import pytest from openai.types.responses import ResponseCustomToolCall from agents import RunConfig, Runner...
361
13,636
openai-agents-python
tests/sandbox/test_runtime_agent_preparation.py
.py
from __future__ import annotations import asyncio from collections.abc import Awaitable, Callable, Coroutine from pathlib import Path from typing import Any, cast import pytest from agents import UserError from agents.models.default_models import get_default_model from agents.run_context import RunContextWrapper fro...
322
10,868
openai-agents-python
tests/sandbox/test_manifest_application.py
.py
from __future__ import annotations import asyncio from collections.abc import Awaitable, Callable, Sequence from pathlib import Path import pytest import agents.sandbox.session.manifest_application as manifest_application_module from agents.sandbox.entries import ( Dir, File, GCSMount, InContainerMou...
454
15,597
openai-agents-python
tests/sandbox/test_workspace_paths.py
.py
from __future__ import annotations import os from collections.abc import Callable from dataclasses import dataclass from pathlib import Path, PurePath, PurePosixPath, PureWindowsPath from typing import Any, cast import pytest from pydantic import ValidationError from agents.sandbox import Manifest, SandboxPathGrant,...
806
28,388
openai-agents-python
tests/sandbox/test_types.py
.py
from agents.sandbox.types import Group, Permissions, User def test_permissions_is_hashable() -> None: # ``Permissions`` overrides ``__eq__``; without a matching ``__hash__`` Pydantic v2 # would set ``__hash__ = None``, breaking sets and dict keys for what is otherwise # a value-like type. Sibling classes ...
23
980
openai-agents-python
tests/sandbox/test_pty_output.py
.py
from __future__ import annotations import asyncio from collections import deque import pytest from agents.sandbox.session.pty_output import collect_pty_output @pytest.mark.asyncio async def test_collect_pty_output_waits_for_notification() -> None: output_chunks: deque[bytes] = deque() output_lock = asyncio...
60
1,626