sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
browser-use/browser-use:tests/scripts/debug_iframe_scrolling.py
""" Debug test for iframe scrolling issue where DOM tree only shows top elements after scrolling. This test verifies that after scrolling inside an iframe, the selector_map correctly contains lower input elements like City, State, Zip Code, etc. """ import asyncio import sys from pathlib import Path # Add parent dir...
{ "repo_id": "browser-use/browser-use", "file_path": "tests/scripts/debug_iframe_scrolling.py", "license": "MIT License", "lines": 257, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
browser-use/browser-use:tests/scripts/test_frame_hierarchy.py
#!/usr/bin/env python3 """Test frame hierarchy for any URL passed as argument.""" import asyncio import sys from browser_use.browser import BrowserSession from browser_use.browser.events import BrowserStartEvent from browser_use.browser.profile import BrowserProfile async def analyze_frame_hierarchy(url): """Analy...
{ "repo_id": "browser-use/browser-use", "file_path": "tests/scripts/test_frame_hierarchy.py", "license": "MIT License", "lines": 198, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
browser-use/browser-use:browser_use/cli.py
# pyright: reportMissingImports=false # Check for MCP mode early to prevent logging initialization import sys if '--mcp' in sys.argv: import logging import os os.environ['BROWSER_USE_LOGGING_LEVEL'] = 'critical' os.environ['BROWSER_USE_SETUP_LOGGING'] = 'false' logging.disable(logging.CRITICAL) # Special case:...
{ "repo_id": "browser-use/browser-use", "file_path": "browser_use/cli.py", "license": "MIT License", "lines": 1980, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/tests/test_present_file_tool_core_logic.py
"""Core behavior tests for present_files path normalization.""" import importlib from types import SimpleNamespace present_file_tool_module = importlib.import_module( "src.tools.builtins.present_file_tool" ) def _make_runtime(outputs_path: str) -> SimpleNamespace: return SimpleNamespace( state={"thr...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_present_file_tool_core_logic.py", "license": "MIT License", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/gateway/routers/suggestions.py
import json import logging from fastapi import APIRouter from pydantic import BaseModel, Field from src.models import create_chat_model logger = logging.getLogger(__name__) router = APIRouter(prefix="/api", tags=["suggestions"]) class SuggestionMessage(BaseModel): role: str = Field(..., description="Message r...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/suggestions.py", "license": "MIT License", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/tests/test_suggestions_router.py
import asyncio from unittest.mock import MagicMock from src.gateway.routers import suggestions def test_strip_markdown_code_fence_removes_wrapping(): text = "```json\n[\"a\"]\n```" assert suggestions._strip_markdown_code_fence(text) == "[\"a\"]" def test_strip_markdown_code_fence_no_fence_keeps_content(): ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_suggestions_router.py", "license": "MIT License", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/community/infoquest/infoquest_client.py
"""Util that calls InfoQuest Search And Fetch API. In order to set this up, follow instructions at: https://docs.byteplus.com/en/docs/InfoQuest/What_is_Info_Quest """ import json import logging import os from typing import Any import requests logger = logging.getLogger(__name__) class InfoQuestClient: """Clie...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/infoquest/infoquest_client.py", "license": "MIT License", "lines": 263, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/infoquest/tools.py
from langchain.tools import tool from src.config import get_app_config from src.utils.readability import ReadabilityExtractor from .infoquest_client import InfoQuestClient readability_extractor = ReadabilityExtractor() def _get_infoquest_client() -> InfoQuestClient: search_config = get_app_config().get_tool_co...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/infoquest/tools.py", "license": "MIT License", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/tests/test_infoquest_client.py
"""Tests for InfoQuest client and tools.""" import json from unittest.mock import MagicMock, patch from src.community.infoquest import tools from src.community.infoquest.infoquest_client import InfoQuestClient class TestInfoQuestClient: def test_infoquest_client_initialization(self): """Test InfoQuestCl...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_infoquest_client.py", "license": "MIT License", "lines": 147, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_subagent_executor.py
"""Tests for subagent executor async/sync execution paths. Covers: - SubagentExecutor.execute() synchronous execution path - SubagentExecutor._aexecute() asynchronous execution path - asyncio.run() properly executes async workflow within thread pool context - Error handling in both sync and async paths - Async tool su...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_subagent_executor.py", "license": "MIT License", "lines": 477, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_uploads_middleware_core_logic.py
"""Core behaviour tests for UploadsMiddleware. Covers: - _files_from_kwargs: parsing, validation, existence check, virtual-path construction - _create_files_message: output format with new-only and new+historical files - before_agent: full injection pipeline (string & list content, preserved additional_kwargs, histo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_uploads_middleware_core_logic.py", "license": "MIT License", "lines": 269, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_memory_upload_filtering.py
"""Tests for upload-event filtering in the memory pipeline. Covers two functions introduced to prevent ephemeral file-upload context from persisting in long-term memory: - _filter_messages_for_memory (memory_middleware) - _strip_upload_mentions_from_memory (updater) """ from langchain_core.messages import AIMe...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_memory_upload_filtering.py", "license": "MIT License", "lines": 194, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/config/agents_config.py
"""Configuration and loaders for custom agents.""" import logging import re from typing import Any import yaml from pydantic import BaseModel from src.config.paths import get_paths logger = logging.getLogger(__name__) SOUL_FILENAME = "SOUL.md" AGENT_NAME_PATTERN = re.compile(r"^[A-Za-z0-9-]+$") class AgentConfig...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/agents_config.py", "license": "MIT License", "lines": 85, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/gateway/routers/agents.py
"""CRUD API for custom agents.""" import logging import re import shutil import yaml from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field from src.config.agents_config import AgentConfig, list_custom_agents, load_agent_config, load_agent_soul from src.config.paths import get_paths logg...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/agents.py", "license": "MIT License", "lines": 294, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/tools/builtins/setup_agent_tool.py
import logging import yaml from langchain_core.messages import ToolMessage from langchain_core.tools import tool from langgraph.prebuilt import ToolRuntime from langgraph.types import Command from src.config.paths import get_paths logger = logging.getLogger(__name__) @tool def setup_agent( soul: str, descr...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/tools/builtins/setup_agent_tool.py", "license": "MIT License", "lines": 48, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/tests/test_custom_agent.py
"""Tests for custom agent support.""" from __future__ import annotations from pathlib import Path from unittest.mock import patch import pytest import yaml from fastapi.testclient import TestClient # --------------------------------------------------------------------------- # Helpers # ----------------------------...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_custom_agent.py", "license": "MIT License", "lines": 384, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_reflection_resolvers.py
"""Tests for reflection resolvers.""" import pytest from src.reflection import resolvers from src.reflection.resolvers import resolve_variable def test_resolve_variable_reports_install_hint_for_missing_google_provider(monkeypatch: pytest.MonkeyPatch): """Missing google provider should return actionable install ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_reflection_resolvers.py", "license": "MIT License", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_skills_loader.py
"""Tests for recursive skills loading.""" from pathlib import Path from src.skills.loader import load_skills def _write_skill(skill_dir: Path, name: str, description: str) -> None: """Write a minimal SKILL.md for tests.""" skill_dir.mkdir(parents=True, exist_ok=True) content = f"---\nname: {name}\ndescr...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_skills_loader.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/mcp/oauth.py
"""OAuth token support for MCP HTTP/SSE servers.""" from __future__ import annotations import asyncio import logging from dataclasses import dataclass from datetime import UTC, datetime, timedelta from typing import Any from src.config.extensions_config import ExtensionsConfig, McpOAuthConfig logger = logging.getLo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/mcp/oauth.py", "license": "MIT License", "lines": 114, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/tests/test_mcp_oauth.py
"""Tests for MCP OAuth support.""" from __future__ import annotations import asyncio from typing import Any from src.config.extensions_config import ExtensionsConfig from src.mcp.oauth import OAuthTokenManager, build_oauth_tool_interceptor, get_initial_oauth_headers class _MockResponse: def __init__(self, payl...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_mcp_oauth.py", "license": "MIT License", "lines": 152, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_readability.py
"""Tests for readability extraction fallback behavior.""" import subprocess import pytest from src.utils.readability import ReadabilityExtractor def test_extract_article_falls_back_when_readability_js_fails(monkeypatch): """When Node-based readability fails, extraction should fall back to Python mode.""" ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_readability.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_uploads_router.py
import asyncio from io import BytesIO from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch from fastapi import UploadFile from src.gateway.routers import uploads def test_upload_files_writes_thread_storage_and_skips_local_sandbox_sync(tmp_path): thread_uploads_dir = tmp_path / "uploads...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_uploads_router.py", "license": "MIT License", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_mcp_client_config.py
"""Core behavior tests for MCP client server config building.""" import pytest from src.config.extensions_config import ExtensionsConfig, McpServerConfig from src.mcp.client import build_server_params, build_servers_config def test_build_server_params_stdio_success(): config = McpServerConfig( type="std...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_mcp_client_config.py", "license": "MIT License", "lines": 67, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_task_tool_core_logic.py
"""Core behavior tests for task tool orchestration.""" import importlib from enum import Enum from types import SimpleNamespace from unittest.mock import MagicMock from src.subagents.config import SubagentConfig # Use module import so tests can patch the exact symbols referenced inside task_tool(). task_tool_module ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_task_tool_core_logic.py", "license": "MIT License", "lines": 201, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/client.py
"""DeerFlowClient β€” Embedded Python client for DeerFlow agent system. Provides direct programmatic access to DeerFlow's agent capabilities without requiring LangGraph Server or Gateway API processes. Usage: from src.client import DeerFlowClient client = DeerFlowClient() response = client.chat("Analyze th...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/client.py", "license": "MIT License", "lines": 714, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/tests/test_client.py
"""Tests for DeerFlowClient.""" import json import tempfile import zipfile from pathlib import Path from unittest.mock import MagicMock, patch import pytest from langchain_core.messages import AIMessage, HumanMessage, ToolMessage # noqa: F401 from src.client import DeerFlowClient from src.gateway.routers.mcp import...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_client.py", "license": "MIT License", "lines": 1264, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_client_live.py
"""Live integration tests for DeerFlowClient with real API. These tests require a working config.yaml with valid API credentials. They are skipped in CI and must be run explicitly: PYTHONPATH=. uv run pytest tests/test_client_live.py -v -s """ import json import os from pathlib import Path import pytest from s...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_client_live.py", "license": "MIT License", "lines": 263, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_lead_agent_model_resolution.py
"""Tests for lead agent runtime model resolution behavior.""" from __future__ import annotations import pytest from src.agents.lead_agent import agent as lead_agent_module from src.config.app_config import AppConfig from src.config.model_config import ModelConfig from src.config.sandbox_config import SandboxConfig ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_lead_agent_model_resolution.py", "license": "MIT License", "lines": 102, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/config/paths.py
import os import re from pathlib import Path # Virtual path prefix seen by agents inside the sandbox VIRTUAL_PATH_PREFIX = "/mnt/user-data" _SAFE_THREAD_ID_RE = re.compile(r"^[A-Za-z0-9_\-]+$") class Paths: """ Centralized path configuration for DeerFlow application data. Directory layout (host side): ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/paths.py", "license": "MIT License", "lines": 141, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/config/subagents_config.py
"""Configuration for the subagent system loaded from config.yaml.""" import logging from pydantic import BaseModel, Field logger = logging.getLogger(__name__) class SubagentOverrideConfig(BaseModel): """Per-agent configuration overrides.""" timeout_seconds: int | None = Field( default=None, ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/subagents_config.py", "license": "MIT License", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/tests/test_subagent_timeout_config.py
"""Tests for subagent timeout configuration. Covers: - SubagentsAppConfig / SubagentOverrideConfig model validation and defaults - get_timeout_for() resolution logic (global vs per-agent) - load_subagents_config_from_dict() and get_subagents_app_config() singleton - registry.get_subagent_config() applies config overri...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_subagent_timeout_config.py", "license": "MIT License", "lines": 275, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_docker_sandbox_mode_detection.py
"""Regression tests for docker sandbox mode detection logic.""" from __future__ import annotations import subprocess import tempfile from pathlib import Path REPO_ROOT = Path(__file__).resolve().parents[2] SCRIPT_PATH = REPO_ROOT / "scripts" / "docker.sh" def _detect_mode_with_config(config_content: str) -> str: ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_docker_sandbox_mode_detection.py", "license": "MIT License", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/tests/test_provisioner_kubeconfig.py
"""Regression tests for provisioner kubeconfig path handling.""" from __future__ import annotations import importlib.util from pathlib import Path def _load_provisioner_module(): """Load docker/provisioner/app.py as an importable test module.""" repo_root = Path(__file__).resolve().parents[2] module_pat...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/tests/test_provisioner_kubeconfig.py", "license": "MIT License", "lines": 87, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
bytedance/deer-flow:backend/src/config/tracing_config.py
import logging import os import threading from pydantic import BaseModel, Field logger = logging.getLogger(__name__) _config_lock = threading.Lock() class TracingConfig(BaseModel): """Configuration for LangSmith tracing.""" enabled: bool = Field(...) api_key: str | None = Field(...) project: str = ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/tracing_config.py", "license": "MIT License", "lines": 41, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/debug.py
#!/usr/bin/env python """ Debug script for lead_agent. Run this file directly in VS Code with breakpoints. Usage: 1. Set breakpoints in agent.py or other files 2. Press F5 or use "Run and Debug" panel 3. Input messages in the terminal to interact with the agent """ import asyncio import logging import os ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/debug.py", "license": "MIT License", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/lead_agent/agent.py
import logging from langchain.agents import create_agent from langchain.agents.middleware import SummarizationMiddleware, TodoListMiddleware from langchain_core.runnables import RunnableConfig from src.agents.lead_agent.prompt import apply_prompt_template from src.agents.middlewares.clarification_middleware import Cl...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/lead_agent/agent.py", "license": "MIT License", "lines": 260, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/lead_agent/prompt.py
from datetime import datetime from src.config.agents_config import load_agent_soul from src.skills import load_skills def _build_subagent_section(max_concurrent: int) -> str: """Build the subagent system prompt section with dynamic concurrency limit. Args: max_concurrent: Maximum number of concurren...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/lead_agent/prompt.py", "license": "MIT License", "lines": 322, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/agents/memory/prompt.py
"""Prompt templates for memory update and injection.""" import re from typing import Any try: import tiktoken TIKTOKEN_AVAILABLE = True except ImportError: TIKTOKEN_AVAILABLE = False # Prompt template for updating memory based on conversation MEMORY_UPDATE_PROMPT = """You are a memory management system....
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/memory/prompt.py", "license": "MIT License", "lines": 220, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/agents/memory/queue.py
"""Memory update queue with debounce mechanism.""" import threading import time from dataclasses import dataclass, field from datetime import datetime from typing import Any from src.config.memory_config import get_memory_config @dataclass class ConversationContext: """Context for a conversation to be processed...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/memory/queue.py", "license": "MIT License", "lines": 152, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/memory/updater.py
"""Memory updater for reading, writing, and updating memory data.""" import json import re import uuid from datetime import datetime from pathlib import Path from typing import Any from src.agents.memory.prompt import ( MEMORY_UPDATE_PROMPT, format_conversation_for_update, ) from src.config.memory_config impo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/memory/updater.py", "license": "MIT License", "lines": 305, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/middlewares/clarification_middleware.py
"""Middleware for intercepting clarification requests and presenting them to the user.""" from collections.abc import Callable from typing import override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langchain_core.messages import ToolMessage from langgraph.grap...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/clarification_middleware.py", "license": "MIT License", "lines": 135, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/middlewares/dangling_tool_call_middleware.py
"""Middleware to fix dangling tool calls in message history. A dangling tool call occurs when an AIMessage contains tool_calls but there are no corresponding ToolMessages in the history (e.g., due to user interruption or request cancellation). This causes LLM errors due to incomplete message format. This middleware i...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/dangling_tool_call_middleware.py", "license": "MIT License", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/middlewares/memory_middleware.py
"""Middleware for memory mechanism.""" import re from typing import Any, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.agents.memory.queue import get_memory_queue from src.config.memory_config import get_memory_...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/memory_middleware.py", "license": "MIT License", "lines": 121, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/middlewares/subagent_limit_middleware.py
"""Middleware to enforce maximum concurrent subagent tool calls per model response.""" import logging from typing import override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.subagents.executor import MAX_CONCURRENT_SUB...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/subagent_limit_middleware.py", "license": "MIT License", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/agents/middlewares/thread_data_middleware.py
from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.agents.thread_state import ThreadDataState from src.config.paths import Paths, get_paths class ThreadDataMiddlewareState(AgentState)...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/thread_data_middleware.py", "license": "MIT License", "lines": 69, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/agents/middlewares/title_middleware.py
"""Middleware for automatic thread title generation.""" from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.config.title_config import get_title_config from src.models import create_cha...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/title_middleware.py", "license": "MIT License", "lines": 70, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/middlewares/uploads_middleware.py
"""Middleware to inject uploaded files information into agent context.""" import logging from pathlib import Path from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langchain_core.messages import HumanMessage from langgraph.run...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/uploads_middleware.py", "license": "MIT License", "lines": 162, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/agents/middlewares/view_image_middleware.py
"""Middleware for injecting image details into conversation before LLM call.""" from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime impor...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/middlewares/view_image_middleware.py", "license": "MIT License", "lines": 165, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/agents/thread_state.py
from typing import Annotated, NotRequired, TypedDict from langchain.agents import AgentState class SandboxState(TypedDict): sandbox_id: NotRequired[str | None] class ThreadDataState(TypedDict): workspace_path: NotRequired[str | None] uploads_path: NotRequired[str | None] outputs_path: NotRequired[s...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/agents/thread_state.py", "license": "MIT License", "lines": 41, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/community/aio_sandbox/aio_sandbox.py
import base64 import logging from agent_sandbox import Sandbox as AioSandboxClient from src.sandbox.sandbox import Sandbox logger = logging.getLogger(__name__) class AioSandbox(Sandbox): """Sandbox implementation using the agent-infra/sandbox Docker container. This sandbox connects to a running AIO sandbo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/aio_sandbox.py", "license": "MIT License", "lines": 105, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/aio_sandbox/aio_sandbox_provider.py
"""AIO Sandbox Provider — orchestrates sandbox lifecycle with pluggable backends. This provider composes two abstractions: - SandboxBackend: how sandboxes are provisioned (local container vs remote/K8s) - SandboxStateStore: how thread→sandbox mappings are persisted (file vs Redis) The provider itself handles: - In-pr...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/aio_sandbox_provider.py", "license": "MIT License", "lines": 402, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/aio_sandbox/backend.py
"""Abstract base class for sandbox provisioning backends.""" from __future__ import annotations import logging import time from abc import ABC, abstractmethod import requests from .sandbox_info import SandboxInfo logger = logging.getLogger(__name__) def wait_for_sandbox_ready(sandbox_url: str, timeout: int = 30)...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/backend.py", "license": "MIT License", "lines": 73, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/community/aio_sandbox/file_state_store.py
"""File-based sandbox state store. Uses JSON files for persistence and fcntl file locking for cross-process mutual exclusion. Works across processes on the same machine or across K8s pods with a shared PVC mount. """ from __future__ import annotations import fcntl import json import logging import os from collection...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/file_state_store.py", "license": "MIT License", "lines": 82, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/aio_sandbox/local_backend.py
"""Local container backend for sandbox provisioning. Manages sandbox containers using Docker or Apple Container on the local machine. Handles container lifecycle, port allocation, and cross-process container discovery. """ from __future__ import annotations import logging import subprocess from src.utils.network im...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/local_backend.py", "license": "MIT License", "lines": 240, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/aio_sandbox/remote_backend.py
"""Remote sandbox backend β€” delegates Pod lifecycle to the provisioner service. The provisioner dynamically creates per-sandbox-id Pods + NodePort Services in k3s. The backend accesses sandbox pods directly via ``k3s:{NodePort}``. Architecture: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” HTTP β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” K8s API β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/remote_backend.py", "license": "MIT License", "lines": 129, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/aio_sandbox/sandbox_info.py
"""Sandbox metadata for cross-process discovery and state persistence.""" from __future__ import annotations import time from dataclasses import dataclass, field @dataclass class SandboxInfo: """Persisted sandbox metadata that enables cross-process discovery. This dataclass holds all the information needed...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/sandbox_info.py", "license": "MIT License", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/community/aio_sandbox/state_store.py
"""Abstract base class for sandbox state persistence. The state store handles cross-process persistence of thread_id β†’ sandbox mappings, enabling different processes (gateway, langgraph, multiple workers) to find the same sandbox for a given thread. """ from __future__ import annotations from abc import ABC, abstrac...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/aio_sandbox/state_store.py", "license": "MIT License", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/community/firecrawl/tools.py
import json from firecrawl import FirecrawlApp from langchain.tools import tool from src.config import get_app_config def _get_firecrawl_client() -> FirecrawlApp: config = get_app_config().get_tool_config("web_search") api_key = None if config is not None: api_key = config.model_extra.get("api_k...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/firecrawl/tools.py", "license": "MIT License", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/community/image_search/tools.py
""" Image Search Tool - Search images using DuckDuckGo for reference in image generation. """ import json import logging from langchain.tools import tool from src.config import get_app_config logger = logging.getLogger(__name__) def _search_images( query: str, max_results: int = 5, region: str = "wt-w...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/image_search/tools.py", "license": "MIT License", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/community/jina_ai/jina_client.py
import logging import os import requests logger = logging.getLogger(__name__) class JinaClient: def crawl(self, url: str, return_format: str = "html", timeout: int = 10) -> str: headers = { "Content-Type": "application/json", "X-Return-Format": return_format, "X-Timeo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/jina_ai/jina_client.py", "license": "MIT License", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/community/jina_ai/tools.py
from langchain.tools import tool from src.community.jina_ai.jina_client import JinaClient from src.config import get_app_config from src.utils.readability import ReadabilityExtractor readability_extractor = ReadabilityExtractor() @tool("web_fetch", parse_docstring=True) def web_fetch_tool(url: str) -> str: """F...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/jina_ai/tools.py", "license": "MIT License", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/community/tavily/tools.py
import json from langchain.tools import tool from tavily import TavilyClient from src.config import get_app_config def _get_tavily_client() -> TavilyClient: config = get_app_config().get_tool_config("web_search") api_key = None if config is not None and "api_key" in config.model_extra: api_key =...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/community/tavily/tools.py", "license": "MIT License", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/app_config.py
import os from pathlib import Path from typing import Any, Self import yaml from dotenv import load_dotenv from pydantic import BaseModel, ConfigDict, Field from src.config.extensions_config import ExtensionsConfig from src.config.memory_config import load_memory_config_from_dict from src.config.model_config import M...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/app_config.py", "license": "MIT License", "lines": 166, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/config/extensions_config.py
"""Unified extensions configuration for MCP servers and skills.""" import json import os from pathlib import Path from typing import Any, Literal from pydantic import BaseModel, ConfigDict, Field class McpOAuthConfig(BaseModel): """OAuth configuration for an MCP server (HTTP/SSE transports).""" enabled: bo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/extensions_config.py", "license": "MIT License", "lines": 195, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/config/memory_config.py
"""Configuration for memory mechanism.""" from pydantic import BaseModel, Field class MemoryConfig(BaseModel): """Configuration for global memory mechanism.""" enabled: bool = Field( default=True, description="Whether to enable memory mechanism", ) storage_path: str = Field( ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/memory_config.py", "license": "MIT License", "lines": 66, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/model_config.py
from pydantic import BaseModel, ConfigDict, Field class ModelConfig(BaseModel): """Config section for a model""" name: str = Field(..., description="Unique name for the model") display_name: str | None = Field(..., default_factory=lambda: None, description="Display name for the model") description: s...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/model_config.py", "license": "MIT License", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/sandbox_config.py
from pydantic import BaseModel, ConfigDict, Field class VolumeMountConfig(BaseModel): """Configuration for a volume mount.""" host_path: str = Field(..., description="Path on the host machine") container_path: str = Field(..., description="Path inside the container") read_only: bool = Field(default=F...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/sandbox_config.py", "license": "MIT License", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/skills_config.py
from pathlib import Path from pydantic import BaseModel, Field class SkillsConfig(BaseModel): """Configuration for skills system""" path: str | None = Field( default=None, description="Path to skills directory. If not specified, defaults to ../skills relative to backend directory", ) ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/skills_config.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/summarization_config.py
"""Configuration for conversation summarization.""" from typing import Literal from pydantic import BaseModel, Field ContextSizeType = Literal["fraction", "tokens", "messages"] class ContextSize(BaseModel): """Context size specification for trigger or keep parameters.""" type: ContextSizeType = Field(desc...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/summarization_config.py", "license": "MIT License", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/title_config.py
"""Configuration for automatic thread title generation.""" from pydantic import BaseModel, Field class TitleConfig(BaseModel): """Configuration for automatic thread title generation.""" enabled: bool = Field( default=True, description="Whether to enable automatic title generation", ) ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/title_config.py", "license": "MIT License", "lines": 41, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/config/tool_config.py
from pydantic import BaseModel, ConfigDict, Field class ToolGroupConfig(BaseModel): """Config section for a tool group""" name: str = Field(..., description="Unique name for the tool group") model_config = ConfigDict(extra="allow") class ToolConfig(BaseModel): """Config section for a tool""" n...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/config/tool_config.py", "license": "MIT License", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/gateway/app.py
import logging import sys from collections.abc import AsyncGenerator from contextlib import asynccontextmanager from fastapi import FastAPI from src.config.app_config import get_app_config from src.gateway.config import get_gateway_config from src.gateway.routers import ( agents, artifacts, mcp, memor...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/app.py", "license": "MIT License", "lines": 135, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/gateway/config.py
import os from pydantic import BaseModel, Field class GatewayConfig(BaseModel): """Configuration for the API Gateway.""" host: str = Field(default="0.0.0.0", description="Host to bind the gateway server") port: int = Field(default=8001, description="Port to bind the gateway server") cors_origins: li...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/config.py", "license": "MIT License", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/gateway/path_utils.py
"""Shared path resolution for thread virtual paths (e.g. mnt/user-data/outputs/...).""" from pathlib import Path from fastapi import HTTPException from src.config.paths import get_paths def resolve_thread_virtual_path(thread_id: str, virtual_path: str) -> Path: """Resolve a virtual path to the actual filesyste...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/path_utils.py", "license": "MIT License", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/gateway/routers/artifacts.py
import logging import mimetypes import zipfile from pathlib import Path from urllib.parse import quote from fastapi import APIRouter, HTTPException, Request from fastapi.responses import FileResponse, HTMLResponse, PlainTextResponse, Response from src.gateway.path_utils import resolve_thread_virtual_path logger = lo...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/artifacts.py", "license": "MIT License", "lines": 119, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/gateway/routers/mcp.py
import json import logging from pathlib import Path from typing import Literal from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field from src.config.extensions_config import ExtensionsConfig, get_extensions_config, reload_extensions_config logger = logging.getLogger(__name__) router = AP...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/mcp.py", "license": "MIT License", "lines": 134, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/gateway/routers/memory.py
"""Memory API router for retrieving and managing global memory data.""" from fastapi import APIRouter from pydantic import BaseModel, Field from src.agents.memory.updater import get_memory_data, reload_memory_data from src.config.memory_config import get_memory_config router = APIRouter(prefix="/api", tags=["memory"...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/memory.py", "license": "MIT License", "lines": 161, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/gateway/routers/models.py
from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field from src.config import get_app_config router = APIRouter(prefix="/api", tags=["models"]) class ModelResponse(BaseModel): """Response model for model information.""" name: str = Field(..., description="Unique identifier for t...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/models.py", "license": "MIT License", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/gateway/routers/skills.py
import json import logging import re import shutil import tempfile import zipfile from pathlib import Path import yaml from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field from src.config.extensions_config import ExtensionsConfig, SkillStateConfig, get_extensions_config, reload_extension...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/skills.py", "license": "MIT License", "lines": 349, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/gateway/routers/uploads.py
"""Upload router for handling file uploads.""" import logging from pathlib import Path from fastapi import APIRouter, File, HTTPException, UploadFile from pydantic import BaseModel from src.config.paths import VIRTUAL_PATH_PREFIX, get_paths from src.sandbox.sandbox_provider import get_sandbox_provider logger = logg...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/gateway/routers/uploads.py", "license": "MIT License", "lines": 177, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/mcp/cache.py
"""Cache for MCP tools to avoid repeated loading.""" import asyncio import logging import os from langchain_core.tools import BaseTool logger = logging.getLogger(__name__) _mcp_tools_cache: list[BaseTool] | None = None _cache_initialized = False _initialization_lock = asyncio.Lock() _config_mtime: float | None = No...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/mcp/cache.py", "license": "MIT License", "lines": 102, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/mcp/client.py
"""MCP client using langchain-mcp-adapters.""" import logging from typing import Any from src.config.extensions_config import ExtensionsConfig, McpServerConfig logger = logging.getLogger(__name__) def build_server_params(server_name: str, config: McpServerConfig) -> dict[str, Any]: """Build server parameters f...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/mcp/client.py", "license": "MIT License", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/mcp/tools.py
"""Load MCP tools using langchain-mcp-adapters.""" import logging from langchain_core.tools import BaseTool from src.config.extensions_config import ExtensionsConfig from src.mcp.client import build_servers_config from src.mcp.oauth import build_oauth_tool_interceptor, get_initial_oauth_headers logger = logging.get...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/mcp/tools.py", "license": "MIT License", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/models/factory.py
import logging from langchain.chat_models import BaseChatModel from src.config import get_app_config, get_tracing_config, is_tracing_enabled from src.reflection import resolve_class logger = logging.getLogger(__name__) def create_chat_model(name: str | None = None, thinking_enabled: bool = False, **kwargs) -> Base...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/models/factory.py", "license": "MIT License", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/models/patched_deepseek.py
"""Patched ChatDeepSeek that preserves reasoning_content in multi-turn conversations. This module provides a patched version of ChatDeepSeek that properly handles reasoning_content when sending messages back to the API. The original implementation stores reasoning_content in additional_kwargs but doesn't include it wh...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/models/patched_deepseek.py", "license": "MIT License", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/reflection/resolvers.py
from importlib import import_module MODULE_TO_PACKAGE_HINTS = { "langchain_google_genai": "langchain-google-genai", "langchain_anthropic": "langchain-anthropic", "langchain_openai": "langchain-openai", "langchain_deepseek": "langchain-deepseek", } def _build_missing_dependency_hint(module_path: str, ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/reflection/resolvers.py", "license": "MIT License", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/sandbox/exceptions.py
"""Sandbox-related exceptions with structured error information.""" class SandboxError(Exception): """Base exception for all sandbox-related errors.""" def __init__(self, message: str, details: dict | None = None): super().__init__(message) self.message = message self.details = detail...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/exceptions.py", "license": "MIT License", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/sandbox/local/list_dir.py
import fnmatch from pathlib import Path IGNORE_PATTERNS = [ # Version Control ".git", ".svn", ".hg", ".bzr", # Dependencies "node_modules", "__pycache__", ".venv", "venv", ".env", "env", ".tox", ".nox", ".eggs", "*.egg-info", "site-packages", # Bu...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/local/list_dir.py", "license": "MIT License", "lines": 98, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/sandbox/local/local_sandbox.py
import os import shutil import subprocess from pathlib import Path from src.sandbox.local.list_dir import list_dir from src.sandbox.sandbox import Sandbox class LocalSandbox(Sandbox): def __init__(self, id: str, path_mappings: dict[str, str] | None = None): """ Initialize local sandbox with optio...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/local/local_sandbox.py", "license": "MIT License", "lines": 163, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/sandbox/local/local_sandbox_provider.py
from src.sandbox.local.local_sandbox import LocalSandbox from src.sandbox.sandbox import Sandbox from src.sandbox.sandbox_provider import SandboxProvider _singleton: LocalSandbox | None = None class LocalSandboxProvider(SandboxProvider): def __init__(self): """Initialize the local sandbox provider with p...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/local/local_sandbox_provider.py", "license": "MIT License", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/sandbox/middleware.py
from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.agents.thread_state import SandboxState, ThreadDataState from src.sandbox import get_sandbox_provider class SandboxMiddlewareState(A...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/middleware.py", "license": "MIT License", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/sandbox/sandbox.py
from abc import ABC, abstractmethod class Sandbox(ABC): """Abstract base class for sandbox environments""" _id: str def __init__(self, id: str): self._id = id @property def id(self) -> str: return self._id @abstractmethod def execute_command(self, command: str) -> str: ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/sandbox.py", "license": "MIT License", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/sandbox/sandbox_provider.py
from abc import ABC, abstractmethod from src.config import get_app_config from src.reflection import resolve_class from src.sandbox.sandbox import Sandbox class SandboxProvider(ABC): """Abstract base class for sandbox providers""" @abstractmethod def acquire(self, thread_id: str | None = None) -> str: ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/sandbox_provider.py", "license": "MIT License", "lines": 70, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/sandbox/tools.py
import re from langchain.tools import ToolRuntime, tool from langgraph.typing import ContextT from src.agents.thread_state import ThreadDataState, ThreadState from src.config.paths import VIRTUAL_PATH_PREFIX from src.sandbox.exceptions import ( SandboxError, SandboxNotFoundError, SandboxRuntimeError, ) fr...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/sandbox/tools.py", "license": "MIT License", "lines": 332, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/skills/loader.py
import os from pathlib import Path from .parser import parse_skill_file from .types import Skill def get_skills_root_path() -> Path: """ Get the root path of the skills directory. Returns: Path to the skills directory (deer-flow/skills) """ # backend directory is current file's parent's ...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/skills/loader.py", "license": "MIT License", "lines": 77, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
bytedance/deer-flow:backend/src/skills/parser.py
import re from pathlib import Path from .types import Skill def parse_skill_file(skill_file: Path, category: str, relative_path: Path | None = None) -> Skill | None: """ Parse a SKILL.md file and extract metadata. Args: skill_file: Path to the SKILL.md file category: Category of the skil...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/skills/parser.py", "license": "MIT License", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/skills/types.py
from dataclasses import dataclass from pathlib import Path @dataclass class Skill: """Represents a skill with its metadata and file path""" name: str description: str license: str | None skill_dir: Path skill_file: Path relative_path: Path # Relative path from category root to skill dire...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/skills/types.py", "license": "MIT License", "lines": 42, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
bytedance/deer-flow:backend/src/subagents/builtins/bash_agent.py
"""Bash command execution subagent configuration.""" from src.subagents.config import SubagentConfig BASH_AGENT_CONFIG = SubagentConfig( name="bash", description="""Command execution specialist for running bash commands in a separate context. Use this subagent when: - You need to run a series of related bash...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/subagents/builtins/bash_agent.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/subagents/builtins/general_purpose.py
"""General-purpose subagent configuration.""" from src.subagents.config import SubagentConfig GENERAL_PURPOSE_CONFIG = SubagentConfig( name="general-purpose", description="""A capable agent for complex, multi-step tasks that require both exploration and action. Use this subagent when: - The task requires bot...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/subagents/builtins/general_purpose.py", "license": "MIT License", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
bytedance/deer-flow:backend/src/subagents/config.py
"""Subagent configuration definitions.""" from dataclasses import dataclass, field @dataclass class SubagentConfig: """Configuration for a subagent. Attributes: name: Unique identifier for the subagent. description: When Claude should delegate to this subagent. system_prompt: The sys...
{ "repo_id": "bytedance/deer-flow", "file_path": "backend/src/subagents/config.py", "license": "MIT License", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation