DeepSearch Code-Actions Agent (DSCA). Build 🙌 with 🤗 smolagents
See the codeVIBE 🖖 Build with 💖 for Humanity with AI
![]()
🚅
![]()
Come From Open Source, This is the Way
README Update Date: 2025-08-10
[v0.3.3.dev] Dev Status: "✅ Complete the development and integration of the DSCA front-end Alpha version"

The DeepSearchAgent project embodies the philosophy that executable code as action is the most powerful paradigm for AI agents. By treating code generation and execution as the primary means of interaction with the world, we unlock unprecedented flexibility and capability in autonomous systems.
The DeepSearchAgent project is an intelligent agent system based on the ReAct (Reasoning + Acting) reasoning and action framework and the CodeAct ("Code as Action") AI agent concept. It aims to realize broader task reasoning and execution through "DeepResearch" DR-Multi-Agent, leveraging DeepSearch's multi-step network deep search foundational capabilities. It utilizes the reasoning power of AI language models (LLMs), along with a toolbox collection and programming action invocation abilities within a Python packages sandbox, enabling it to handle complex web search tasks that are both broad and deep via multi-step deep search, multimodal webpage text processing, reading, and multi-step reasoning. The system also provides traceable reference materials. Built upon Hugging Face's smolagents framework, this project implements a dual-mode intelligent agent system capable of invoking predefined toolboxes as well as writing action code—realizing both "generation of dedicated dynamic DSLs based on task plans" and "AI self-created dynamic one-time dedicated tools.
The project supports a CLI TUI interface for terminal command-line operation, a standard FastAPI service, the FastMCP MCP server, and a modern WebTUI frontend with terminal-style aesthetics. The WebTUI (v0.3.3) features real-time WebSocket streaming, a cyberpunk-inspired design system, and optimized performance for displaying the CodeAct Agent Run process. It facilitates developers in experimentation, integration, and usage across various systems. This is an open-source project aimed at providing VIBER beginners with a friendly Code Agent experience, learning opportunities, and extensibility.
config.toml (src/core/config/settings.py).Reference Use Cases (To be updated v0.3.1+)
WebTUI Demo:

CodeAct Mode Example: Full CLI run showing multi-step deep search process.




Development Plan Currently Under Intensive Iteration:
[DONE] Developed Web API v2 with real-time WebSocket streaming (v0.3.2) - Simplified Gradio message pass-through architecture replacing complex event-driven system (~5000 lines reduced to ~500 lines). Frontend development and Docker packaging pending;
[DONE] Added MCP Client/MCP tools HUB to DeepSearchAgents' DeepSearchToolbox, supporting MCP Tools configuration and invocation;
[DONE] Provided packaging of DeepSearchAgents as an MCP server, offering DeepSearchAgent MCP tools services;
[DONE] Supported multi-vertical search engine source aggregation (Google, X.com, Jina AI, Exa Neural) with hybrid search aggregation and intelligent result deduplication (v0.3.1);
[DONE] Upgraded to smolagents v1.19.0 with hierarchical agent management, parallel tool execution, and enhanced streaming architecture;
[DONE] Add a DeepWiki Remote MCP tool to enhance the GitHub URLs vertical crawler/parser with GitHub Repository Q&A capabilities (v0.3.1);
[Partially supported in the tool layer] The deep search strategy provides more strategy parameters and adds support for strategy parameters based on Tokens budget;
[Experimental version testing] Implement auxiliary methods and tools for Agent Action search width & depth based on Monte Carlo Tree Search strategies in DeepSearchAgents, along with strategy control parameters;
[TODO] LLM as Judge: Experimentally add an Agent Runs evaluator for DeepSearchAgents (independently evaluate the deep search paths & results of DeepSearchAgents);
[TODO] Add persistent memory layer functionality for Agents & provide users with persistent search records;
Add suitable open-source sandbox (E2B-like) adapted code_sandbox Docker automation configuration, and increase support for more remote code_sandbox secure environment SDKs;
Integrate full-process Agent Runs telemetry adaptation ("OpenTelemetry" & Langfuse) (integrated together with the Docker packaged version);
[TODO] Human-in-the-loop & multi-path branching backtracking functionality for Agent Runs;
[Experimental] Special implementation version of multi_agent_HiRA (Hierarchical Reasoning Framework for Deep Search) based on special tokens protocol (arXiv-2507.02652v1);
[Experimental] Add auxiliary method optimization to the agent omni-tools-query pipeline based on [submodular-optimization] ("submodular optimization algorithm") to improve reQuery query effectiveness when using various external query tools; this auxiliary pipeline uses "submodular optimization algorithms" to optimize query selection, generate diversified tool search query inputs, perform effect evaluation, and return ReAct Agent action callbacks to help the Agent observe query result optimization effects in order to continuously iterate towards retrieval goals in subsequent Steps Actions. (https://jina.ai/news/submodular-optimization-for-diverse-query-generation-in-deepresearch/)
This section guides you through setting up the environment, installing dependencies, and running DeepSearchAgent via its command-line interface or standard FastAPI service.
Prerequisites:
uv (Recommended, faster alternative to pip/venv): Install uv.Clone the Repository:
git clone https://github.com/DeepSearch-AgentTeam/DeepSearchAgent.git
cd DeepSearchAgent
Create Virtual Environment (Recommended):
# Using uv
uv venv
source .venv/bin/activate # Unix/macOS
# .venv\Scripts\activate # Windows
# Or using standard venv
# python -m venv .venv
# source .venv/bin/activate # Unix/macOS
# .venv\Scripts\activate # Windows
Install Dependencies:
For running the FastAPI service:
uv pip install .
For running the CLI or for Development:
# Installs core + CLI dependencies + development tools in editable mode
uv pip install -e ".[cli]"
For Development:
uv pip install -e ".[dev,test,cli]"
Configure:
# Create configuration files from templates
cp config.template.toml config.toml
cp .env.template .env
# Edit config.toml for models, agent parameters, service settings
# nano config.toml
# Edit .env for API keys (LITELLM_MASTER_KEY, SERPER_API_KEY, etc.)
# nano .env
Configuration Details:
config.toml: Contains non-sensitive configurations like model IDs, agent parameters (max steps, executor type), service settings (host, port).
.env: Contains only sensitive API keys (e.g., LITELLM_MASTER_KEY, SERPER_API_KEY, JINA_API_KEY, WOLFRAM_ALPHA_APP_ID).
Ensure you have installed the CLI dependencies (see Step 4 in Installation & Setup).
# Run the CLI (interactive mode, uses settings from config.toml)
make cli
# or directly:
uv run python -m src.agents.cli
# Run with specific agent mode
python -m src.cli --agent-type react # ReAct DeepSearch agent mode (Baseline ToolCalling mode)
python -m src.cli --agent-type codact # CodeAct DeepSearch agent mode
python -m src.cli --agent-type manager # Manager multi-agent mode (v0.2.9)
# Manager multi-agent mode with research team
python -m src.cli --agent-type manager --team research
CLI arguments will override settings defined in config.toml.
Ensure you have installed the core dependencies (see Step 4 in Installation & Setup).
# Start the main API server (uses host/port from config.toml, e.g., http://0.0.0.0:8000)
make run
# or directly:
uv run -- uvicorn src.agents.main:app --reload
# Note: --host and --port are now taken from config.toml via main.py
# Use LOG_LEVEL environment variable for log level (e.g., LOG_LEVEL=debug make run)
API Endpoints:
POST /run_codact_agent: Runs the CodeAct DeepSearch agent.POST /run_deepsearch_agent: Runs the agent configured by service.deepsearch_agent_mode in config.toml (or DEEPSEARCH_AGENT_MODE env var).GET /: API info and health check.Example API request to the configured deep search REST API endpoint:
curl -X POST http://localhost:8000/run_deepsearch_agent \
-H "Content-Type: application/json" \
-d '{"user_input": "Search the latest news about OpenAI'''s new GPT-4.1 API."}'
(Replace localhost:8000 with the actual host and port if changed in config.toml)
The Web API v2 provides real-time WebSocket streaming for the WebTUI frontend integration. This major refactoring (v0.3.2-v0.3.3) delivers a clean, maintainable architecture that processes agent events directly through the web_ui.py module, paired with a modern terminal-style web interface.
Architecture Overview:
Agent (React/CodeAct) → stream_agent_messages() → DSAgentMessageProcessor → WebSocket → Frontend
WebTUI Frontend Features:
Backend WebAPI WebSocket Event:
PlanningStep: Agent planning with strategy updatesActionStep: Tool execution with thoughts and resultsFinalAnswerStep: Structured final answersChatMessageStreamDelta: Real-time streaming updatesQuick Start:
// Connect to WebSocket
const ws = new WebSocket('ws://localhost:8000/api/v2/ws/my-session?agent_type=codact');
// Handle incoming messages with component routing
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
// Route based on metadata
if (message.metadata?.component === 'chat') {
// Display in chat (planning, thoughts, final answers)
} else if (message.metadata?.component === 'webide') {
// Show in code editor (Python execution)
} else if (message.metadata?.component === 'terminal') {
// Display in terminal (tool outputs, logs)
}
};
// Send query
ws.send(JSON.stringify({type: 'query', query: 'Your question here'}));
Message Format:
DSAgentRunMessage includes routing metadataSee src/api/v2/README.md for comprehensive documentation, src/api/v2/STREAM_EVENTS.md for event flow details, and src/api/v2/examples/ for example implementations.
Starting the WebTUI Frontend:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
# The WebTUI will be available at http://localhost:3000
For production deployment:
npm run build
npm start
See frontend/README.md for detailed frontend documentation and configuration options.
deepsearch_tool)DeepSearchAgent now supports serving as a Model Context Protocol (MCP) server, exposing deep search capabilities as an MCP tool deepsearch_tool that can be accessed by any MCP client.
# Run the FastMCP server with default settings
python -m src.agents.servers.run_fastmcp
# or
python -m src.agents.servers.run_fastmcp --agent-type codact --port 8100
This starts a FastMCP server with Streamable HTTP transport at http://localhost:8100/mcp (default), providing access to DeepSearchAgent's functionality through the deepsearch_tool endpoint.
Server Arguments:
--agent-type: Agent type to use (codact or react, default: codact)--port: Port number for server (default: 8100)--host: Host address (default: 0.0.0.0)--debug: Enable debug logging--path: Custom URL path (default: /mcp)Debugging with MCP Inspector:
The MCP Inspector can be used to debug and interact with the DeepSearchAgent MCP server:
npm install -g @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector
In the browser UI that opens (typically at http://127.0.0.1:6274):
Streamable HTTPhttp://localhost:8100/mcpYou'll see real-time progress updates and the final search results rendered in the MCP Inspector Web UI.
FastMCP Server in FastAPI Application:
You can also embed the FastMCP server in the main FastAPI application:
# Run main API server with FastMCP integration
python -m src.main --enable-fastmcp --agent-type codact
When run with --enable-fastmcp, the main API server mounts the FastMCP server at /mcp-server (default) for integrated operation.
DeepSearchAgents includes a modern web frontend built with Next.js that provides a rich interface for interacting with agents through the Web API v2.
Technology Stack:
Setup Frontend Development Environment:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# or
yarn install
# Create environment variables
cp .env.example .env.local
# Edit .env.local to set backend URLs
# NEXT_PUBLIC_API_URL=http://localhost:8000
# NEXT_PUBLIC_WS_URL=ws://localhost:8000
Development Commands:
# Start development server (http://localhost:3000)
npm run dev
# Build for production
npm run build
# Run production server
npm run start
# Run linting
npm run lint
Key Frontend Features:
AgentChat: Main chat interface with message groupingActionThoughtCard: Displays agent reasoning (truncated to 60 chars)PlanningCard: Shows planning steps with badgesFinalAnswerDisplay: Structured final answer renderingFrontend Integration Example:
// Using the WebSocket hook
import { useWebSocket } from '@/hooks/use-websocket';
function MyComponent() {
const { messages, sendMessage, isConnected } = useWebSocket({
sessionId: 'my-session',
agentType: 'codact'
});
const handleQuery = () => {
sendMessage({
type: 'query',
query: 'Search for latest AI developments'
});
};
return (
<div>
{messages.map(msg => (
<AgentChat key={msg.message_id} message={msg} />
))}
</div>
);
}
See frontend/README-DeepSearchAgents.md for comprehensive frontend documentation and development guidelines.
The core system architecture includes:
src/agents/react_agent.py, src/agents/codact_agent.py, src/agents/manager_agent.py): Implement ReAct, CodeAct, and Manager agent logic based on smolagents. Manager agent (v0.2.9) orchestrates teams of specialized agents for collaborative problem-solving.src/agents/runtime.py): Responsible for managing the agent's runtime environment, including hierarchical agent orchestration.src/tools/): Functions that the agent can invoke (such as web search, reading URLs, etc.).src/api): FastAPI service providing REST API related services.src/cli.py): Provides an interactive command-line interface with rich formatting.src/api/v2/): Real-time WebSocket API with direct agent event processing via web_ui.py and DSAgentMessageProcessor, transforming smolagents events into metadata-rich messages for frontend component routing.src/agents/servers/run_fastmcp.py): FastMCP server providing MCP tools services with Streamable HTTP transport.The Web API v2 features a streamlined architecture that processes AI agent long-running multi-step task events directly:
Event Processing Pipeline:
smolagents Events → web_ui.py → DSAgentMessageProcessor → WebSocket → Frontend Components
Key Components:
web_ui.py: Core event processor handling 4 main event types from smolagentsDSAgentMessageProcessor: Wraps processed events into DSAgentRunMessage formatEvent Type Mapping:
Architecture diagram updated for version v0.3.2.rc2
See docs/architecture-diagram/architecture-diagram-v0.3.2.rc2.mmd for the latest architecture diagram details.
DeepSearchAgent supports two modes of agent operation: the CodeAct code-execution mode and the ReAct tool-calling mode. The default mode used by the /run_deepsearch_agent endpoint is configured in config.toml (service.deepsearch_agent_mode) or via the DEEPSEARCH_AGENT_MODE environment variable.
Both modes now support streaming output, providing real-time visibility into the agent's reasoning and execution process.
In CodeAct mode, the agent produces executable Python code, and by running that code the agent completes its reasoning and actions. This allows for more complex operations, combining multiple steps into one code execution.
Example format:
results = search_links("example query")
content = read_url(results[0]["link"])
final_answer("The result is...")
In ReAct mode, the agent operates in the classic reasoning+acting manner, with actions executed by invoking predefined tools. During its reasoning process, the LLM generates structured "action" outputs that specify which tool to use and with what parameters.
Example format:
{
"name": "search_links",
"arguments": {
"query": "example query"
}
}
| Differences | ToolCalling ReAct Mode | CodeAct Mode |
|---|---|---|
| Action Representation | Structured JSON instructions | Executable Python code |
| Complex Operation Capability | Multiple steps for complex logic | Can combine multiple steps with programming constructs |
| Model Requirements | General conversational ability | Requires code generation capability |
| Debugging & Interpretability | Human-readable thoughts and actions | Code traces with error feedback |
| Best For | Simple queries, fixed workflows | Complex tasks, flexible tool orchestration |
| Streaming Support | Support | Support |
| Planning Capability | Periodic planning every N steps | Periodic planning every N steps |
Manager mode introduces hierarchical agent orchestration, where a manager agent coordinates a team of specialized agents to solve complex problems collaboratively. This mode leverages the managed agents support added in smolagents v1.19.0.
Architecture:
Research Team Configuration:
The default research team includes:
Example Usage:
# CLI with research team
python -m src.cli --agent-type manager --team research
# Custom team configuration
python -m src.cli --agent-type manager --team custom --managed-agents react codact
Benefits:
| Feature | Manager Mode |
|---|---|
| Agent Coordination | Hierarchical delegation to specialized agents |
| Complex Query Handling | Breaks down into subtasks for team members |
| Model Requirements | Orchestration + specialized agent capabilities |
| Best For | Multi-faceted research, comparative analysis, complex workflows |
| Team Composition | Configurable teams of ReAct/CodeAct agents |
DeepSearchAgent comes with an extensible toolchain that helps the agent retrieve and process information. These tools work in concert to form a complete query-answering pipeline:
search_links: Accepts a query string and uses external search engine APIs to retrieve web results with titles, snippets, and URLs. Enhanced in v0.3.1: Now supports hybrid search with multiple providers:
search_fast (v0.3.1): Optimized search tool for speed-critical operationsgithub_repo_qa (v0.3.1): AI-powered GitHub repository analysis using DeepWiki MCPread_url: Fetches HTML content from standard web pages and extracts formatted text for analysis. Enhanced in v0.3.1 with modular scraping architecture:
xcom_read_url: Specialized tool for reading X.com (Twitter) content using xAI's Live Search API. Provides real-time access to posts, profiles, and search results.xcom_qa (v0.3.1): Deep Q&A tool for X.com content analysis with search, read, and query operationschunk_text: Splits long text into manageable segments for detailed analysis using intelligent segmentation.embed_texts: Encodes text chunks into vector representations for semantic similarity operations.rerank_texts: Ranks text chunks by relevance to a given query for finding the most relevant information.wolfram (Computation Engine): Calls the WolframAlpha API to handle mathematical calculations or scientific queries.final_answer (Final Answer): Indicates that the agent has reached a conclusion, using structured output & terminating the reasoning loop.NEW in v0.2.8: The toolbox.py module provides a unified interface for managing DeepSearchAgent tools:
config.toml settings# Create tool collection with specific tools
toolbox.create_tool_collection(
api_keys=api_keys,
tool_names=["search_links", "read_url", "xcom_read_url"],
verbose=True
)
# Load tools from Hub collections
toolbox.load_from_hub("collection_slug", trust_remote_code=True)
# Load tools from MCP servers
with toolbox.load_from_mcp(server_params, trust_remote_code=True):
# Use tools from MCP server
pass
In the typical v0.3.1 enhanced sequence:
search_links, which automatically detects whether the query is related to X.com content (mentions @username, hashtags, trending topics) and routes it to the appropriate search engine.read_url to handle standard web content or xcom_read_url for X.com content.chunk_text, embed_texts, and rerank_texts to identify key paragraphs.wolfram for mathematical analysis.final_answer.The enhanced toolchain now offers:
CodeAct refers to a method where agents generate and execute actions in the form of code. The core idea is that at each decision step, the model directly produces executable code, which is run to invoke tools or perform computations.
Compared to static instructions, using code as an action representation offers greater expressive power and flexibility: it can combine multiple tool calls, apply programming logic to handle complex data structures, and even reuse previously defined functions, greatly expanding the agent’s action space.
The agent mode implements periodic planning intervals, allowing the agent to reassess its strategy every N steps. This enables more efficient search paths by:
- ReAct: Synergizing Reasoning and Acting in Language Models
arXiv:2210.03629v3- Executable Code Actions Elicit Better LLM Agents
arXiv:2402.01030v4- DynaSaur: Large Language Agents Beyond Predefined Actions
arXiv:2411.01747v1- LLMCompiler: An LLM Compiler for Parallel Function Calling
arXiv:2312.04511v3- ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models
arXiv:2305.18323v1- smolagents.agents.CodeAgent
- Jina AI DeepResearch repository
- A Practical Guide to Implementing DeepSearch/DeepResearch
config.toml from config.template.toml and customize parameters..env from .env.template and add required API keys:
LITELLM_MASTER_KEY (if using LiteLLM compatible models)SERPER_API_KEY (for web search via search_links)JINA_API_KEY (for content processing via read_url, embed_texts, rerank_texts)WOLFRAM_ALPHA_APP_ID (optional, for computational queries via wolfram)LITELLM_BASE_URL (optional, if using a custom LiteLLM endpoint)Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License
Special thanks to the following open-source projects (as well as other equally important projects not listed), "May the Force be with you":
The DeepSearchAgent project is designed with modern AI engineers and human engineers collaborating in software development and coding workflows in mind. We have integrated special repository workspace rule files (.cursor/rules/*.mdc) to facilitate AI-assisted development and ensure consistency within the codebase.
.cursor/rules/ (.mdc)CLAUDE.md: Claude Code Prompting markdown file.AGENTS.md: Codex CLI & Codex Software engineering Agent, Prompting markdown file..cursor/rules/ FilesThis repository contains special Markdown files in the .cursor/rules/ & CLAUDE.md directory, serving as contextual guideline prompts for human developers and AI coding assistants. These files are similar to the CLAUDE.md concept described in Claude Code Best Practices, providing structured information about project architecture, components, and conventions.
VIBE Programming & Development References:
CLAUDE.md: Claude Code rules & memory file.
agent-architecture.mdc: Documents the agent design patterns (ReAct, CodeAct, and Manager) and their functionalities
configuration.mdc: Provides detailed explanations of the customized configuration system options
interfaces.mdc: Describes the available interfaces (CLI, FastAPI, MCP Tool Server)
jina-ai-api-rules.mdc: Contains guidelines for using various Jina AI APIs within the codebase
periodic-planning.mdc: Explains the cyclical planning features used for strategic reassessment
project-overview.mdc: Offers a comprehensive overview and structure of the project
tools.mdc: Records the functionalities of dedicated tools used for web search, content processing, and analysis
These rules files facilitate collaboration between human developers and AI engineers by:
When using AI to assist in developing this project, we recommend the following workflow:
.cursor/rules/*.mdc files related to the component you are developing.When pairing with AI engineers to explore the codebase, you can start like this:
Please help me understand the DeepSearchAgent architecture. Refer to .cursor/rules/project-overview.mdc and .cursor/rules/agent-architecture.mdc for details.
When adding a new tool to the tool collection:
I need to add a new tool for YouTube video analysis. Please implement it following the pattern in .cursor/rules/tools.mdc and the code style in .cursor/rules/python-code-style-pep8.mdc.
When modifying the configuration system:
I need to add new configuration options for depth search Tokens budget & index depth. Please advise on how to extend the configuration structure according to .cursor/rules/configuration.mdc.
As the project evolves, we encourage contributors to update and expand these rules files. If you're adding a new major component or changing existing architecture, please update the relevant .mdc files to reflect these changes. This helps maintain the documentation as a living resource that accurately represents the current state of the codebase.
src/
├── agents/ # Agent implementations and core logic
│ ├── prompt_templates/ # Modular prompt template system
│ │ ├── __init__.py
│ │ ├── codact_prompts.py # CodeAct agent prompts and templates
│ │ └── react_prompts.py # ReAct agent prompts and templates
│ ├── servers/ # Server implementations
│ │ ├── __init__.py
│ │ ├── run_fastmcp.py # FastMCP MCP server implementation
│ │ └── run_fastmcp.py # FastMCP MCP server
│ ├── ui_common/ # Shared UI components and utilities
│ │ ├── __init__.py
│ │ ├── agent_step_callback.py # Agent execution step callbacks
│ │ ├── console_formatter.py # Console output formatting
│ │ ├── constants.py # UI-related constants
│ │ └── streaming_formatter.py # Streaming output formatter (v0.2.9)
│ ├── __init__.py
│ ├── base_agent.py # Base agent interface and common functionality
│ ├── codact_agent.py # CodeAct agent implementation
│ ├── manager_agent.py # Manager agent implementation (v0.2.9)
│ ├── react_agent.py # ReAct agent implementation
│ ├── run_result.py # Agent run result objects (v0.2.9)
│ ├── runtime.py # Agent runtime manager
│ └── stream_aggregator.py # Stream aggregation logic (v0.2.9)
├── api/ # FastAPI service components
│ ├── v1/ # API version 1 implementation
│ │ ├── endpoints/ # API endpoint definitions
│ │ │ ├── __init__.py
│ │ │ ├── agent.py # Agent-related endpoints
│ │ │ └── health.py # Health check endpoints
│ │ ├── __init__.py
│ │ └── router.py # API router configuration
│ ├── v2/ # API version 2 (v0.3.2) - WebSocket streaming
│ │ ├── examples/ # Example client implementations
│ │ │ ├── test_agent_steps_full.js # WebSocket streaming test
│ │ │ ├── test_debug.py # Direct processor testing
│ │ │ └── test_simple_agent.py # Agent integration example
│ │ ├── __init__.py
│ │ ├── endpoints.py # WebSocket and REST endpoints
│ │ ├── web_ui.py # Core event processing and routing
│ │ ├── ds_agent_message_processor.py # Message processor wrapper
│ │ ├── main.py # Standalone API server
│ │ ├── models.py # Pydantic data models
│ │ ├── openapi.yaml # OpenAPI specification
│ │ ├── README.md # Comprehensive v2 documentation
│ │ ├── STREAM_EVENTS.md # Event flow documentation
│ │ ├── session.py # Session management
│ │ └── WebAPIv2-GUI-Interface-API-Docs.md # Frontend integration guide
│ ├── __init__.py
│ └── api.py # Main API configuration
├── core/ # Core system components
│ ├── chunk/ # Text chunking components
│ │ └── segmenter.py # Text Chunker
│ ├── config/ # Configuration handling
│ │ ├── __init__.py
│ │ └── settings.py # Settings management and configuration loading
│ ├── ranking/ # Content ranking and embedding
│ │ ├── __init__.py
│ │ ├── base_ranker.py # Base ranking interface
│ │ ├── chunker.py # Text chunking utilities
│ │ ├── jina_embedder.py # Jina AI Token Embedder
│ │ └── jina_reranker.py # Jina AI Reranker
│ ├── scraping/ # Web content scraping (v0.3.1 refactored)
│ │ ├── __init__.py
│ │ ├── base.py # Base scraper abstraction
│ │ ├── result.py # Scraping result data structures
│ │ ├── scrape_url.py # Main scraping orchestrator
│ │ ├── scraper_firecrawl.py # Firecrawl Scraper
│ │ ├── scraper_jinareader.py # JinaReader Scraper
│ │ ├── scraper_xcom.py # X.com (Twitter) specialized scraper
│ │ └── utils.py # Scraping utility functions
│ ├── search_engines/ # Search engine integrations (v0.3.1 expanded)
│ │ ├── utils/ # Search utility modules
│ │ │ ├── __init__.py
│ │ │ └── search_token_counter.py # Token counting utilities
│ │ ├── __init__.py
│ │ ├── base.py # Base search client abstraction
│ │ ├── search_exa.py # Exa Search
│ │ ├── search_hybrid.py # Hybrid Search Aggregator
│ │ ├── search_jina.py # Jina AI Search
│ │ ├── search_serper.py # Serper API (Google) search engine
│ │ ├── search_xcom.py # X.com search base
│ │ └── search_xcom_sdk.py # X.com SDK implementation
│ ├── github_toolkit/ # GitHub integration tools (v0.3.1)
│ │ ├── __init__.py
│ │ └── deepwiki.py # DeepWiki Remote MCP client wrapper
│ ├── xcom_toolkit/ # X.com toolkit (v0.3.1)
│ │ ├── __init__.py
│ │ └── xai_live_search.py # xAI Live Search client
│ └── __init__.py
├── tools/ # Agent Tools Collection (v0.3.1 expanded)
│ ├── __init__.py
│ ├── chunk.py # Text chunking tool
│ ├── embed.py # Text embedding tool
│ ├── final_answer.py # Final answer formatter tool
│ ├── github_qa.py # GitHub repository Q&A tool (v0.3.1)
│ ├── readurl.py # Generic URL content reading tool
│ ├── rerank.py # Content reranking tool
│ ├── search.py # Multi-engine Hybrid web search tool
│ ├── search_fast.py # Fast search tool (v0.3.1)
│ ├── search_helpers.py # Search helper utilities (v0.3.1)
│ ├── toolbox.py # Tool management and registry system
│ ├── wolfram.py # Symbolic computational tool
│ ├── xcom_qa.py # X.com Deep Q&A tool (v0.3.1)
│ └── xcom_readurl.py # X.com (Twitter) URL reading tool
├── cli.py # Command-line interface version
└── main.py # FastAPI main entry
frontend/ # Next.js web frontend for DSCA WebTUI (v0.3.3)
164 commits
Python
80.2%
TypeScript
13.1%
CSS
5.1%
HTML
1.5%
DeepSearch Code-Actions Agent (DSCA). Build 🙌 with 🤗 smolagents
See the codeVIBE 🖖 Build with 💖 for Humanity with AI
![]()
🚅
![]()
Come From Open Source, This is the Way
README Update Date: 2025-08-10
[v0.3.3.dev] Dev Status: "✅ Complete the development and integration of the DSCA front-end Alpha version"

The DeepSearchAgent project embodies the philosophy that executable code as action is the most powerful paradigm for AI agents. By treating code generation and execution as the primary means of interaction with the world, we unlock unprecedented flexibility and capability in autonomous systems.
The DeepSearchAgent project is an intelligent agent system based on the ReAct (Reasoning + Acting) reasoning and action framework and the CodeAct ("Code as Action") AI agent concept. It aims to realize broader task reasoning and execution through "DeepResearch" DR-Multi-Agent, leveraging DeepSearch's multi-step network deep search foundational capabilities. It utilizes the reasoning power of AI language models (LLMs), along with a toolbox collection and programming action invocation abilities within a Python packages sandbox, enabling it to handle complex web search tasks that are both broad and deep via multi-step deep search, multimodal webpage text processing, reading, and multi-step reasoning. The system also provides traceable reference materials. Built upon Hugging Face's smolagents framework, this project implements a dual-mode intelligent agent system capable of invoking predefined toolboxes as well as writing action code—realizing both "generation of dedicated dynamic DSLs based on task plans" and "AI self-created dynamic one-time dedicated tools.
The project supports a CLI TUI interface for terminal command-line operation, a standard FastAPI service, the FastMCP MCP server, and a modern WebTUI frontend with terminal-style aesthetics. The WebTUI (v0.3.3) features real-time WebSocket streaming, a cyberpunk-inspired design system, and optimized performance for displaying the CodeAct Agent Run process. It facilitates developers in experimentation, integration, and usage across various systems. This is an open-source project aimed at providing VIBER beginners with a friendly Code Agent experience, learning opportunities, and extensibility.
config.toml (src/core/config/settings.py).Reference Use Cases (To be updated v0.3.1+)
WebTUI Demo:

CodeAct Mode Example: Full CLI run showing multi-step deep search process.




Development Plan Currently Under Intensive Iteration:
[DONE] Developed Web API v2 with real-time WebSocket streaming (v0.3.2) - Simplified Gradio message pass-through architecture replacing complex event-driven system (~5000 lines reduced to ~500 lines). Frontend development and Docker packaging pending;
[DONE] Added MCP Client/MCP tools HUB to DeepSearchAgents' DeepSearchToolbox, supporting MCP Tools configuration and invocation;
[DONE] Provided packaging of DeepSearchAgents as an MCP server, offering DeepSearchAgent MCP tools services;
[DONE] Supported multi-vertical search engine source aggregation (Google, X.com, Jina AI, Exa Neural) with hybrid search aggregation and intelligent result deduplication (v0.3.1);
[DONE] Upgraded to smolagents v1.19.0 with hierarchical agent management, parallel tool execution, and enhanced streaming architecture;
[DONE] Add a DeepWiki Remote MCP tool to enhance the GitHub URLs vertical crawler/parser with GitHub Repository Q&A capabilities (v0.3.1);
[Partially supported in the tool layer] The deep search strategy provides more strategy parameters and adds support for strategy parameters based on Tokens budget;
[Experimental version testing] Implement auxiliary methods and tools for Agent Action search width & depth based on Monte Carlo Tree Search strategies in DeepSearchAgents, along with strategy control parameters;
[TODO] LLM as Judge: Experimentally add an Agent Runs evaluator for DeepSearchAgents (independently evaluate the deep search paths & results of DeepSearchAgents);
[TODO] Add persistent memory layer functionality for Agents & provide users with persistent search records;
Add suitable open-source sandbox (E2B-like) adapted code_sandbox Docker automation configuration, and increase support for more remote code_sandbox secure environment SDKs;
Integrate full-process Agent Runs telemetry adaptation ("OpenTelemetry" & Langfuse) (integrated together with the Docker packaged version);
[TODO] Human-in-the-loop & multi-path branching backtracking functionality for Agent Runs;
[Experimental] Special implementation version of multi_agent_HiRA (Hierarchical Reasoning Framework for Deep Search) based on special tokens protocol (arXiv-2507.02652v1);
[Experimental] Add auxiliary method optimization to the agent omni-tools-query pipeline based on [submodular-optimization] ("submodular optimization algorithm") to improve reQuery query effectiveness when using various external query tools; this auxiliary pipeline uses "submodular optimization algorithms" to optimize query selection, generate diversified tool search query inputs, perform effect evaluation, and return ReAct Agent action callbacks to help the Agent observe query result optimization effects in order to continuously iterate towards retrieval goals in subsequent Steps Actions. (https://jina.ai/news/submodular-optimization-for-diverse-query-generation-in-deepresearch/)
This section guides you through setting up the environment, installing dependencies, and running DeepSearchAgent via its command-line interface or standard FastAPI service.
Prerequisites:
uv (Recommended, faster alternative to pip/venv): Install uv.Clone the Repository:
git clone https://github.com/DeepSearch-AgentTeam/DeepSearchAgent.git
cd DeepSearchAgent
Create Virtual Environment (Recommended):
# Using uv
uv venv
source .venv/bin/activate # Unix/macOS
# .venv\Scripts\activate # Windows
# Or using standard venv
# python -m venv .venv
# source .venv/bin/activate # Unix/macOS
# .venv\Scripts\activate # Windows
Install Dependencies:
For running the FastAPI service:
uv pip install .
For running the CLI or for Development:
# Installs core + CLI dependencies + development tools in editable mode
uv pip install -e ".[cli]"
For Development:
uv pip install -e ".[dev,test,cli]"
Configure:
# Create configuration files from templates
cp config.template.toml config.toml
cp .env.template .env
# Edit config.toml for models, agent parameters, service settings
# nano config.toml
# Edit .env for API keys (LITELLM_MASTER_KEY, SERPER_API_KEY, etc.)
# nano .env
Configuration Details:
config.toml: Contains non-sensitive configurations like model IDs, agent parameters (max steps, executor type), service settings (host, port).
.env: Contains only sensitive API keys (e.g., LITELLM_MASTER_KEY, SERPER_API_KEY, JINA_API_KEY, WOLFRAM_ALPHA_APP_ID).
Ensure you have installed the CLI dependencies (see Step 4 in Installation & Setup).
# Run the CLI (interactive mode, uses settings from config.toml)
make cli
# or directly:
uv run python -m src.agents.cli
# Run with specific agent mode
python -m src.cli --agent-type react # ReAct DeepSearch agent mode (Baseline ToolCalling mode)
python -m src.cli --agent-type codact # CodeAct DeepSearch agent mode
python -m src.cli --agent-type manager # Manager multi-agent mode (v0.2.9)
# Manager multi-agent mode with research team
python -m src.cli --agent-type manager --team research
CLI arguments will override settings defined in config.toml.
Ensure you have installed the core dependencies (see Step 4 in Installation & Setup).
# Start the main API server (uses host/port from config.toml, e.g., http://0.0.0.0:8000)
make run
# or directly:
uv run -- uvicorn src.agents.main:app --reload
# Note: --host and --port are now taken from config.toml via main.py
# Use LOG_LEVEL environment variable for log level (e.g., LOG_LEVEL=debug make run)
API Endpoints:
POST /run_codact_agent: Runs the CodeAct DeepSearch agent.POST /run_deepsearch_agent: Runs the agent configured by service.deepsearch_agent_mode in config.toml (or DEEPSEARCH_AGENT_MODE env var).GET /: API info and health check.Example API request to the configured deep search REST API endpoint:
curl -X POST http://localhost:8000/run_deepsearch_agent \
-H "Content-Type: application/json" \
-d '{"user_input": "Search the latest news about OpenAI'''s new GPT-4.1 API."}'
(Replace localhost:8000 with the actual host and port if changed in config.toml)
The Web API v2 provides real-time WebSocket streaming for the WebTUI frontend integration. This major refactoring (v0.3.2-v0.3.3) delivers a clean, maintainable architecture that processes agent events directly through the web_ui.py module, paired with a modern terminal-style web interface.
Architecture Overview:
Agent (React/CodeAct) → stream_agent_messages() → DSAgentMessageProcessor → WebSocket → Frontend
WebTUI Frontend Features:
Backend WebAPI WebSocket Event:
PlanningStep: Agent planning with strategy updatesActionStep: Tool execution with thoughts and resultsFinalAnswerStep: Structured final answersChatMessageStreamDelta: Real-time streaming updatesQuick Start:
// Connect to WebSocket
const ws = new WebSocket('ws://localhost:8000/api/v2/ws/my-session?agent_type=codact');
// Handle incoming messages with component routing
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
// Route based on metadata
if (message.metadata?.component === 'chat') {
// Display in chat (planning, thoughts, final answers)
} else if (message.metadata?.component === 'webide') {
// Show in code editor (Python execution)
} else if (message.metadata?.component === 'terminal') {
// Display in terminal (tool outputs, logs)
}
};
// Send query
ws.send(JSON.stringify({type: 'query', query: 'Your question here'}));
Message Format:
DSAgentRunMessage includes routing metadataSee src/api/v2/README.md for comprehensive documentation, src/api/v2/STREAM_EVENTS.md for event flow details, and src/api/v2/examples/ for example implementations.
Starting the WebTUI Frontend:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
# The WebTUI will be available at http://localhost:3000
For production deployment:
npm run build
npm start
See frontend/README.md for detailed frontend documentation and configuration options.
deepsearch_tool)DeepSearchAgent now supports serving as a Model Context Protocol (MCP) server, exposing deep search capabilities as an MCP tool deepsearch_tool that can be accessed by any MCP client.
# Run the FastMCP server with default settings
python -m src.agents.servers.run_fastmcp
# or
python -m src.agents.servers.run_fastmcp --agent-type codact --port 8100
This starts a FastMCP server with Streamable HTTP transport at http://localhost:8100/mcp (default), providing access to DeepSearchAgent's functionality through the deepsearch_tool endpoint.
Server Arguments:
--agent-type: Agent type to use (codact or react, default: codact)--port: Port number for server (default: 8100)--host: Host address (default: 0.0.0.0)--debug: Enable debug logging--path: Custom URL path (default: /mcp)Debugging with MCP Inspector:
The MCP Inspector can be used to debug and interact with the DeepSearchAgent MCP server:
npm install -g @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector
In the browser UI that opens (typically at http://127.0.0.1:6274):
Streamable HTTPhttp://localhost:8100/mcpYou'll see real-time progress updates and the final search results rendered in the MCP Inspector Web UI.
FastMCP Server in FastAPI Application:
You can also embed the FastMCP server in the main FastAPI application:
# Run main API server with FastMCP integration
python -m src.main --enable-fastmcp --agent-type codact
When run with --enable-fastmcp, the main API server mounts the FastMCP server at /mcp-server (default) for integrated operation.
DeepSearchAgents includes a modern web frontend built with Next.js that provides a rich interface for interacting with agents through the Web API v2.
Technology Stack:
Setup Frontend Development Environment:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# or
yarn install
# Create environment variables
cp .env.example .env.local
# Edit .env.local to set backend URLs
# NEXT_PUBLIC_API_URL=http://localhost:8000
# NEXT_PUBLIC_WS_URL=ws://localhost:8000
Development Commands:
# Start development server (http://localhost:3000)
npm run dev
# Build for production
npm run build
# Run production server
npm run start
# Run linting
npm run lint
Key Frontend Features:
AgentChat: Main chat interface with message groupingActionThoughtCard: Displays agent reasoning (truncated to 60 chars)PlanningCard: Shows planning steps with badgesFinalAnswerDisplay: Structured final answer renderingFrontend Integration Example:
// Using the WebSocket hook
import { useWebSocket } from '@/hooks/use-websocket';
function MyComponent() {
const { messages, sendMessage, isConnected } = useWebSocket({
sessionId: 'my-session',
agentType: 'codact'
});
const handleQuery = () => {
sendMessage({
type: 'query',
query: 'Search for latest AI developments'
});
};
return (
<div>
{messages.map(msg => (
<AgentChat key={msg.message_id} message={msg} />
))}
</div>
);
}
See frontend/README-DeepSearchAgents.md for comprehensive frontend documentation and development guidelines.
The core system architecture includes:
src/agents/react_agent.py, src/agents/codact_agent.py, src/agents/manager_agent.py): Implement ReAct, CodeAct, and Manager agent logic based on smolagents. Manager agent (v0.2.9) orchestrates teams of specialized agents for collaborative problem-solving.src/agents/runtime.py): Responsible for managing the agent's runtime environment, including hierarchical agent orchestration.src/tools/): Functions that the agent can invoke (such as web search, reading URLs, etc.).src/api): FastAPI service providing REST API related services.src/cli.py): Provides an interactive command-line interface with rich formatting.src/api/v2/): Real-time WebSocket API with direct agent event processing via web_ui.py and DSAgentMessageProcessor, transforming smolagents events into metadata-rich messages for frontend component routing.src/agents/servers/run_fastmcp.py): FastMCP server providing MCP tools services with Streamable HTTP transport.The Web API v2 features a streamlined architecture that processes AI agent long-running multi-step task events directly:
Event Processing Pipeline:
smolagents Events → web_ui.py → DSAgentMessageProcessor → WebSocket → Frontend Components
Key Components:
web_ui.py: Core event processor handling 4 main event types from smolagentsDSAgentMessageProcessor: Wraps processed events into DSAgentRunMessage formatEvent Type Mapping:
Architecture diagram updated for version v0.3.2.rc2
See docs/architecture-diagram/architecture-diagram-v0.3.2.rc2.mmd for the latest architecture diagram details.
DeepSearchAgent supports two modes of agent operation: the CodeAct code-execution mode and the ReAct tool-calling mode. The default mode used by the /run_deepsearch_agent endpoint is configured in config.toml (service.deepsearch_agent_mode) or via the DEEPSEARCH_AGENT_MODE environment variable.
Both modes now support streaming output, providing real-time visibility into the agent's reasoning and execution process.
In CodeAct mode, the agent produces executable Python code, and by running that code the agent completes its reasoning and actions. This allows for more complex operations, combining multiple steps into one code execution.
Example format:
results = search_links("example query")
content = read_url(results[0]["link"])
final_answer("The result is...")
In ReAct mode, the agent operates in the classic reasoning+acting manner, with actions executed by invoking predefined tools. During its reasoning process, the LLM generates structured "action" outputs that specify which tool to use and with what parameters.
Example format:
{
"name": "search_links",
"arguments": {
"query": "example query"
}
}
| Differences | ToolCalling ReAct Mode | CodeAct Mode |
|---|---|---|
| Action Representation | Structured JSON instructions | Executable Python code |
| Complex Operation Capability | Multiple steps for complex logic | Can combine multiple steps with programming constructs |
| Model Requirements | General conversational ability | Requires code generation capability |
| Debugging & Interpretability | Human-readable thoughts and actions | Code traces with error feedback |
| Best For | Simple queries, fixed workflows | Complex tasks, flexible tool orchestration |
| Streaming Support | Support | Support |
| Planning Capability | Periodic planning every N steps | Periodic planning every N steps |
Manager mode introduces hierarchical agent orchestration, where a manager agent coordinates a team of specialized agents to solve complex problems collaboratively. This mode leverages the managed agents support added in smolagents v1.19.0.
Architecture:
Research Team Configuration:
The default research team includes:
Example Usage:
# CLI with research team
python -m src.cli --agent-type manager --team research
# Custom team configuration
python -m src.cli --agent-type manager --team custom --managed-agents react codact
Benefits:
| Feature | Manager Mode |
|---|---|
| Agent Coordination | Hierarchical delegation to specialized agents |
| Complex Query Handling | Breaks down into subtasks for team members |
| Model Requirements | Orchestration + specialized agent capabilities |
| Best For | Multi-faceted research, comparative analysis, complex workflows |
| Team Composition | Configurable teams of ReAct/CodeAct agents |
DeepSearchAgent comes with an extensible toolchain that helps the agent retrieve and process information. These tools work in concert to form a complete query-answering pipeline:
search_links: Accepts a query string and uses external search engine APIs to retrieve web results with titles, snippets, and URLs. Enhanced in v0.3.1: Now supports hybrid search with multiple providers:
search_fast (v0.3.1): Optimized search tool for speed-critical operationsgithub_repo_qa (v0.3.1): AI-powered GitHub repository analysis using DeepWiki MCPread_url: Fetches HTML content from standard web pages and extracts formatted text for analysis. Enhanced in v0.3.1 with modular scraping architecture:
xcom_read_url: Specialized tool for reading X.com (Twitter) content using xAI's Live Search API. Provides real-time access to posts, profiles, and search results.xcom_qa (v0.3.1): Deep Q&A tool for X.com content analysis with search, read, and query operationschunk_text: Splits long text into manageable segments for detailed analysis using intelligent segmentation.embed_texts: Encodes text chunks into vector representations for semantic similarity operations.rerank_texts: Ranks text chunks by relevance to a given query for finding the most relevant information.wolfram (Computation Engine): Calls the WolframAlpha API to handle mathematical calculations or scientific queries.final_answer (Final Answer): Indicates that the agent has reached a conclusion, using structured output & terminating the reasoning loop.NEW in v0.2.8: The toolbox.py module provides a unified interface for managing DeepSearchAgent tools:
config.toml settings# Create tool collection with specific tools
toolbox.create_tool_collection(
api_keys=api_keys,
tool_names=["search_links", "read_url", "xcom_read_url"],
verbose=True
)
# Load tools from Hub collections
toolbox.load_from_hub("collection_slug", trust_remote_code=True)
# Load tools from MCP servers
with toolbox.load_from_mcp(server_params, trust_remote_code=True):
# Use tools from MCP server
pass
In the typical v0.3.1 enhanced sequence:
search_links, which automatically detects whether the query is related to X.com content (mentions @username, hashtags, trending topics) and routes it to the appropriate search engine.read_url to handle standard web content or xcom_read_url for X.com content.chunk_text, embed_texts, and rerank_texts to identify key paragraphs.wolfram for mathematical analysis.final_answer.The enhanced toolchain now offers:
CodeAct refers to a method where agents generate and execute actions in the form of code. The core idea is that at each decision step, the model directly produces executable code, which is run to invoke tools or perform computations.
Compared to static instructions, using code as an action representation offers greater expressive power and flexibility: it can combine multiple tool calls, apply programming logic to handle complex data structures, and even reuse previously defined functions, greatly expanding the agent’s action space.
The agent mode implements periodic planning intervals, allowing the agent to reassess its strategy every N steps. This enables more efficient search paths by:
- ReAct: Synergizing Reasoning and Acting in Language Models
arXiv:2210.03629v3- Executable Code Actions Elicit Better LLM Agents
arXiv:2402.01030v4- DynaSaur: Large Language Agents Beyond Predefined Actions
arXiv:2411.01747v1- LLMCompiler: An LLM Compiler for Parallel Function Calling
arXiv:2312.04511v3- ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models
arXiv:2305.18323v1- smolagents.agents.CodeAgent
- Jina AI DeepResearch repository
- A Practical Guide to Implementing DeepSearch/DeepResearch
config.toml from config.template.toml and customize parameters..env from .env.template and add required API keys:
LITELLM_MASTER_KEY (if using LiteLLM compatible models)SERPER_API_KEY (for web search via search_links)JINA_API_KEY (for content processing via read_url, embed_texts, rerank_texts)WOLFRAM_ALPHA_APP_ID (optional, for computational queries via wolfram)LITELLM_BASE_URL (optional, if using a custom LiteLLM endpoint)Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License
Special thanks to the following open-source projects (as well as other equally important projects not listed), "May the Force be with you":
The DeepSearchAgent project is designed with modern AI engineers and human engineers collaborating in software development and coding workflows in mind. We have integrated special repository workspace rule files (.cursor/rules/*.mdc) to facilitate AI-assisted development and ensure consistency within the codebase.
.cursor/rules/ (.mdc)CLAUDE.md: Claude Code Prompting markdown file.AGENTS.md: Codex CLI & Codex Software engineering Agent, Prompting markdown file..cursor/rules/ FilesThis repository contains special Markdown files in the .cursor/rules/ & CLAUDE.md directory, serving as contextual guideline prompts for human developers and AI coding assistants. These files are similar to the CLAUDE.md concept described in Claude Code Best Practices, providing structured information about project architecture, components, and conventions.
VIBE Programming & Development References:
CLAUDE.md: Claude Code rules & memory file.
agent-architecture.mdc: Documents the agent design patterns (ReAct, CodeAct, and Manager) and their functionalities
configuration.mdc: Provides detailed explanations of the customized configuration system options
interfaces.mdc: Describes the available interfaces (CLI, FastAPI, MCP Tool Server)
jina-ai-api-rules.mdc: Contains guidelines for using various Jina AI APIs within the codebase
periodic-planning.mdc: Explains the cyclical planning features used for strategic reassessment
project-overview.mdc: Offers a comprehensive overview and structure of the project
tools.mdc: Records the functionalities of dedicated tools used for web search, content processing, and analysis
These rules files facilitate collaboration between human developers and AI engineers by:
When using AI to assist in developing this project, we recommend the following workflow:
.cursor/rules/*.mdc files related to the component you are developing.When pairing with AI engineers to explore the codebase, you can start like this:
Please help me understand the DeepSearchAgent architecture. Refer to .cursor/rules/project-overview.mdc and .cursor/rules/agent-architecture.mdc for details.
When adding a new tool to the tool collection:
I need to add a new tool for YouTube video analysis. Please implement it following the pattern in .cursor/rules/tools.mdc and the code style in .cursor/rules/python-code-style-pep8.mdc.
When modifying the configuration system:
I need to add new configuration options for depth search Tokens budget & index depth. Please advise on how to extend the configuration structure according to .cursor/rules/configuration.mdc.
As the project evolves, we encourage contributors to update and expand these rules files. If you're adding a new major component or changing existing architecture, please update the relevant .mdc files to reflect these changes. This helps maintain the documentation as a living resource that accurately represents the current state of the codebase.
src/
├── agents/ # Agent implementations and core logic
│ ├── prompt_templates/ # Modular prompt template system
│ │ ├── __init__.py
│ │ ├── codact_prompts.py # CodeAct agent prompts and templates
│ │ └── react_prompts.py # ReAct agent prompts and templates
│ ├── servers/ # Server implementations
│ │ ├── __init__.py
│ │ ├── run_fastmcp.py # FastMCP MCP server implementation
│ │ └── run_fastmcp.py # FastMCP MCP server
│ ├── ui_common/ # Shared UI components and utilities
│ │ ├── __init__.py
│ │ ├── agent_step_callback.py # Agent execution step callbacks
│ │ ├── console_formatter.py # Console output formatting
│ │ ├── constants.py # UI-related constants
│ │ └── streaming_formatter.py # Streaming output formatter (v0.2.9)
│ ├── __init__.py
│ ├── base_agent.py # Base agent interface and common functionality
│ ├── codact_agent.py # CodeAct agent implementation
│ ├── manager_agent.py # Manager agent implementation (v0.2.9)
│ ├── react_agent.py # ReAct agent implementation
│ ├── run_result.py # Agent run result objects (v0.2.9)
│ ├── runtime.py # Agent runtime manager
│ └── stream_aggregator.py # Stream aggregation logic (v0.2.9)
├── api/ # FastAPI service components
│ ├── v1/ # API version 1 implementation
│ │ ├── endpoints/ # API endpoint definitions
│ │ │ ├── __init__.py
│ │ │ ├── agent.py # Agent-related endpoints
│ │ │ └── health.py # Health check endpoints
│ │ ├── __init__.py
│ │ └── router.py # API router configuration
│ ├── v2/ # API version 2 (v0.3.2) - WebSocket streaming
│ │ ├── examples/ # Example client implementations
│ │ │ ├── test_agent_steps_full.js # WebSocket streaming test
│ │ │ ├── test_debug.py # Direct processor testing
│ │ │ └── test_simple_agent.py # Agent integration example
│ │ ├── __init__.py
│ │ ├── endpoints.py # WebSocket and REST endpoints
│ │ ├── web_ui.py # Core event processing and routing
│ │ ├── ds_agent_message_processor.py # Message processor wrapper
│ │ ├── main.py # Standalone API server
│ │ ├── models.py # Pydantic data models
│ │ ├── openapi.yaml # OpenAPI specification
│ │ ├── README.md # Comprehensive v2 documentation
│ │ ├── STREAM_EVENTS.md # Event flow documentation
│ │ ├── session.py # Session management
│ │ └── WebAPIv2-GUI-Interface-API-Docs.md # Frontend integration guide
│ ├── __init__.py
│ └── api.py # Main API configuration
├── core/ # Core system components
│ ├── chunk/ # Text chunking components
│ │ └── segmenter.py # Text Chunker
│ ├── config/ # Configuration handling
│ │ ├── __init__.py
│ │ └── settings.py # Settings management and configuration loading
│ ├── ranking/ # Content ranking and embedding
│ │ ├── __init__.py
│ │ ├── base_ranker.py # Base ranking interface
│ │ ├── chunker.py # Text chunking utilities
│ │ ├── jina_embedder.py # Jina AI Token Embedder
│ │ └── jina_reranker.py # Jina AI Reranker
│ ├── scraping/ # Web content scraping (v0.3.1 refactored)
│ │ ├── __init__.py
│ │ ├── base.py # Base scraper abstraction
│ │ ├── result.py # Scraping result data structures
│ │ ├── scrape_url.py # Main scraping orchestrator
│ │ ├── scraper_firecrawl.py # Firecrawl Scraper
│ │ ├── scraper_jinareader.py # JinaReader Scraper
│ │ ├── scraper_xcom.py # X.com (Twitter) specialized scraper
│ │ └── utils.py # Scraping utility functions
│ ├── search_engines/ # Search engine integrations (v0.3.1 expanded)
│ │ ├── utils/ # Search utility modules
│ │ │ ├── __init__.py
│ │ │ └── search_token_counter.py # Token counting utilities
│ │ ├── __init__.py
│ │ ├── base.py # Base search client abstraction
│ │ ├── search_exa.py # Exa Search
│ │ ├── search_hybrid.py # Hybrid Search Aggregator
│ │ ├── search_jina.py # Jina AI Search
│ │ ├── search_serper.py # Serper API (Google) search engine
│ │ ├── search_xcom.py # X.com search base
│ │ └── search_xcom_sdk.py # X.com SDK implementation
│ ├── github_toolkit/ # GitHub integration tools (v0.3.1)
│ │ ├── __init__.py
│ │ └── deepwiki.py # DeepWiki Remote MCP client wrapper
│ ├── xcom_toolkit/ # X.com toolkit (v0.3.1)
│ │ ├── __init__.py
│ │ └── xai_live_search.py # xAI Live Search client
│ └── __init__.py
├── tools/ # Agent Tools Collection (v0.3.1 expanded)
│ ├── __init__.py
│ ├── chunk.py # Text chunking tool
│ ├── embed.py # Text embedding tool
│ ├── final_answer.py # Final answer formatter tool
│ ├── github_qa.py # GitHub repository Q&A tool (v0.3.1)
│ ├── readurl.py # Generic URL content reading tool
│ ├── rerank.py # Content reranking tool
│ ├── search.py # Multi-engine Hybrid web search tool
│ ├── search_fast.py # Fast search tool (v0.3.1)
│ ├── search_helpers.py # Search helper utilities (v0.3.1)
│ ├── toolbox.py # Tool management and registry system
│ ├── wolfram.py # Symbolic computational tool
│ ├── xcom_qa.py # X.com Deep Q&A tool (v0.3.1)
│ └── xcom_readurl.py # X.com (Twitter) URL reading tool
├── cli.py # Command-line interface version
└── main.py # FastAPI main entry
frontend/ # Next.js web frontend for DSCA WebTUI (v0.3.3)
164 commits
Python
80.2%
TypeScript
13.1%
CSS
5.1%
HTML
1.5%