How ruc-nlpir/deepagent works
Project type and purpose
• DeepAgent is a full-stack Python application implementing a modular, microservice-style reasoning agent.
• It orchestrates LLM-based reasoning, dynamic tool discovery, and execution across multiple benchmarks (ToolBench, API-Bank, ALFWorld, GAIA, WebShop, HLE).
File structure
• Top-level:
• config/ – YAML configurations for models, APIs, and data paths
• data/ – Pre-processed datasets and initial databases for each benchmark
• figures/ – Static images used in README
• src/ – Core Python code, subdivided into:
– envs/ – Environment wrappers (ALFWorld, WebShop)
– evaluate/ – Post-run evaluation scripts per benchmark
– prompts/ – Task-specific LLM prompt templates
– tools/ – Tool modules (API-Bank client, RapidAPI proxy, Python executor, file processor, search, etc.)
– utils/ – Shared utilities (OAS parsing, math equivalence, general helpers)
– run_deep_agent.py & run_tool_search_server.py – Entry points for agent and tool-retriever services
• requirements.txt, LICENSE, README.md
Key insights from README
• Core components:
• DeepAgent orchestrator (main & auxiliary LLMs)
• Tool Retriever micro-service (semantic tool search)
• vLLM model-serving endpoints for reasoning and VQA
• Autonomous memory folding (episodic, working, tool memory)
• Workflows: closed-set vs. open-set (tool search enabled)
• Evaluation pipelines per benchmark
a. Main components:
• CLI / Orchestrator: run_deep_agent.py parses config, dataset, and flags
• Config Loader: reads base_config.yaml, supplies API keys and service URLs
• Data Store (data/): JSON, JSONL, OAS specs, initial DBs
• DeepAgent Core:
• Reasoning Loop & Memory Manager
• Prompt Manager (prompts/)
• Tool Manager (selects and invokes tool modules)
• Microservices:
• Main LLM Service (vLLM endpoint)
• Auxiliary LLM Service (memory folding, tool retrieval hints)
• VQA Service (for GAIA / HLE image tasks)
• Tool Retriever Service (run_tool_search_server.py)
• Tool Modules (src/tools/):
• API-Bank client
• RapidAPI / ToolBench proxy
• RestBench client (TMDB, Spotify)
• Python Executor
• File Processor & Multimodal Tools
• Google Search / Serper API
• ToolHop executor
• Environment Wrappers (src/envs/): ALFWorld, WebShop
• Evaluation Engine (src/evaluate/): per-benchmark metrics
b. Relationships & data flows:
1. User invokes CLI → Config Loader → Data Store
2. Orchestrator → DeepAgent Core
3. Core sends prompt → Main LLM Service → Core receives reasoning token stream
4. Core decides: memory fold? → Auxiliary LLM Service → updates Memory Manager
5. Core chooses tool → Tool Retriever Service (optional) → ranked tool list → Core
6. Core → Tool Manager calls appropriate Tool Module → external API / environment simulator → returns observation
7. Observation → Core → Next prompt → loop until task done
8. Outputs & logs → Evaluation Engine → metrics
c. Architectural patterns & design principles:
• Plugin-based tool architecture: each tool encapsulated in src/tools/ with a unified interface
• Microservices for heavy-weight tasks (LLM inference, tool retrieval)
• Decoupled config and code; all keys, URLs in YAML
• Memory abstraction: segregated episodic, working, and tool memories
• Batch evaluation decoupled via src/evaluate/
d. Technologies & frameworks:
• Python 3.10+
• vLLM for model serving (main, auxiliary, VQA)
• YAML for configuration
• JSON/JSONL for dataset storage
• FastAPI or Flask (implied) for tool-search server
• Conda / pip for environment