youtu-agent 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,95 @@
1
+ from sqlmodel import Session, create_engine, text
2
+
3
+ from .env import EnvUtils
4
+ from .log import get_logger
5
+
6
+ logger = get_logger(__name__)
7
+
8
+
9
+ class SQLModelUtils:
10
+ _engine = None # singleton
11
+ _db_available = None # cache for database availability check
12
+ _last_check_time = None # timestamp of last check
13
+
14
+ @classmethod
15
+ def get_engine(cls):
16
+ if cls._engine is None:
17
+ cls._engine = create_engine(
18
+ EnvUtils.get_env("UTU_DB_URL"), # assert UTU_DB_URL is provided here!
19
+ pool_size=300,
20
+ max_overflow=500,
21
+ pool_timeout=30,
22
+ pool_pre_ping=True,
23
+ )
24
+ # Ensure DB schema/tables exist on first engine init
25
+ try:
26
+ cls._init_db_schema(cls._engine)
27
+ except Exception as e:
28
+ logger.warning(f"Auto schema creation skipped due to error: {e}")
29
+ return cls._engine
30
+
31
+ @staticmethod
32
+ def create_session():
33
+ return Session(SQLModelUtils.get_engine())
34
+
35
+ @classmethod
36
+ def check_db_available(cls, force_check: bool = False, cache_ttl: int = 60) -> bool:
37
+ """Check if database is available with caching.
38
+
39
+ Args:
40
+ force_check: Force a fresh check, bypassing cache
41
+ cache_ttl: Cache time-to-live in seconds (default: 60s)
42
+
43
+ Returns:
44
+ bool: True if database is available, False otherwise
45
+ """
46
+ import time
47
+
48
+ # Return cached result if available and not expired
49
+ if not force_check and cls._db_available is not None and cls._last_check_time is not None:
50
+ if time.time() - cls._last_check_time < cache_ttl:
51
+ logger.debug(f"Using cached DB availability status: {cls._db_available}")
52
+ return cls._db_available
53
+
54
+ # Perform actual check
55
+ logger.debug("Performing fresh database availability check")
56
+
57
+ if not EnvUtils.get_env("UTU_DB_URL", ""):
58
+ cls._db_available = False
59
+ cls._last_check_time = time.time()
60
+ return False
61
+
62
+ try:
63
+ engine = cls.get_engine()
64
+ with engine.connect() as conn:
65
+ conn.execute(text("SELECT 1"))
66
+ cls._db_available = True
67
+ cls._last_check_time = time.time()
68
+ logger.debug("Database is available")
69
+ return True
70
+ except Exception as e:
71
+ cls._db_available = False
72
+ cls._last_check_time = time.time()
73
+ logger.error(f"Database connection failed: {e}")
74
+ return False
75
+
76
+ @staticmethod
77
+ def _init_db_schema(engine):
78
+ """
79
+ Import all SQLModel table definitions and create tables if they do not exist.
80
+ """
81
+ # Import models so SQLModel knows about all tables
82
+ try:
83
+ # Core models registered here
84
+ from utu.db import eval_datapoint, tool_cache_model, tracing_model, trajectory_model # noqa: F401
85
+ except Exception as e:
86
+ logger.debug(f"Model import warning (non-fatal): {e}")
87
+
88
+ # Create tables if not exist
89
+ try:
90
+ from sqlmodel import SQLModel
91
+
92
+ SQLModel.metadata.create_all(engine)
93
+ logger.info("Database schema ensured (tables created if missing).")
94
+ except Exception as e:
95
+ logger.warning(f"SQLModel metadata create_all failed: {e}")
utils/token.py ADDED
@@ -0,0 +1,21 @@
1
+ import tiktoken
2
+
3
+ _tokenizer = tiktoken.get_encoding("cl100k_base")
4
+
5
+
6
+ class TokenUtils:
7
+ @staticmethod
8
+ def truncate_text_by_token(text: str, limit: int = -1) -> str:
9
+ """Truncate text to a given token limit with tiktoken."""
10
+ if limit <= 0 or not text:
11
+ return text
12
+ tokens = _tokenizer.encode(text)
13
+ if len(tokens) <= limit:
14
+ return text
15
+ truncated_tokens = tokens[:limit]
16
+ truncated_text = _tokenizer.decode(truncated_tokens)
17
+ return truncated_text + "..."
18
+
19
+ @staticmethod
20
+ def count_tokens(text: str) -> int:
21
+ return len(_tokenizer.encode(text))
utils/tool_cache.py ADDED
@@ -0,0 +1,121 @@
1
+ import functools
2
+ import hashlib
3
+ import json
4
+ import pathlib
5
+ import time
6
+ from datetime import datetime
7
+ from typing import Literal
8
+
9
+ from sqlmodel import select
10
+
11
+ from ..db import ToolCacheModel
12
+ from ..utils import EnvUtils, SQLModelUtils, get_logger
13
+ from .path import DIR_ROOT
14
+
15
+ logger = get_logger(__name__)
16
+
17
+ DIR_CACHE = DIR_ROOT / ".cache"
18
+ DIR_CACHE.mkdir(exist_ok=True)
19
+
20
+ USE_CACHE = EnvUtils.get_env("UTU_DISABLE_TOOL_CACHE", "").lower() not in ("true", "1")
21
+
22
+
23
+ def create_cached_file(cache_path: pathlib.Path, expire_time: int | None = None):
24
+ def decorator_file(func):
25
+ @functools.wraps(func)
26
+ async def wrapper(*args, **kwargs):
27
+ func_name = func.__name__
28
+ cache_args = args[1:] if args and hasattr(args[0], func.__name__) else args # remove `self`
29
+ args_str = str(cache_args) + str(sorted(kwargs.items()))
30
+ cache_key = hashlib.md5(args_str.encode()).hexdigest()
31
+ cache_file = cache_path / f"{func_name}" / f"{func_name}_{cache_key}.json"
32
+ cache_file.parent.mkdir(exist_ok=True, parents=True)
33
+
34
+ if USE_CACHE and cache_file.exists():
35
+ with open(cache_file) as f:
36
+ cache_data = json.load(f)
37
+
38
+ if expire_time is None or (time.time() - cache_data["metadata"]["timestamp"]) < expire_time:
39
+ logger.debug(f"πŸ”„ Using cached result for {func_name} from {cache_file}")
40
+ return cache_data["result"]
41
+
42
+ start_time = time.time()
43
+ result = await func(*args, **kwargs)
44
+ execution_time = time.time() - start_time
45
+ metadata = {
46
+ "function": func_name,
47
+ "timestamp": time.time(),
48
+ "datetime": datetime.now().isoformat(),
49
+ "args": str(cache_args),
50
+ "kwargs": str(kwargs),
51
+ "execution_time": execution_time,
52
+ }
53
+ cache_data = {"result": result, "metadata": metadata}
54
+
55
+ with open(cache_file, "w") as f:
56
+ json.dump(cache_data, f, ensure_ascii=False, indent=2)
57
+ logger.debug(f"πŸ’Ύ Cached result for {func_name} to {cache_file}")
58
+ return result
59
+
60
+ return wrapper
61
+
62
+ return decorator_file
63
+
64
+
65
+ def create_cached_db(expire_time: int | None = None):
66
+ def decorator_db(func):
67
+ @functools.wraps(func)
68
+ async def wrapper(*args, **kwargs):
69
+ func_name = func.__name__
70
+ cache_args = args[1:] if args and hasattr(args[0], func.__name__) else args # remove `self`
71
+ args_str = str(cache_args) + str(sorted(kwargs.items()))
72
+ cache_key = hashlib.md5(args_str.encode()).hexdigest()
73
+
74
+ with SQLModelUtils.create_session() as session:
75
+ if USE_CACHE:
76
+ stmt = select(ToolCacheModel).where(
77
+ ToolCacheModel.function == func_name, ToolCacheModel.cache_key == cache_key
78
+ )
79
+ if_exist = session.exec(stmt).first() # one_or_none
80
+ if if_exist and (expire_time is None or (time.time() - if_exist.timestamp) < expire_time):
81
+ logger.debug(f"πŸ”„ Using cached result for {func_name} from db")
82
+ return if_exist.result
83
+
84
+ start_time = time.time()
85
+ result = await func(*args, **kwargs)
86
+ execution_time = time.time() - start_time
87
+ data = ToolCacheModel(
88
+ function=func_name,
89
+ args=args_str,
90
+ kwargs=str(kwargs),
91
+ result=result,
92
+ cache_key=cache_key,
93
+ execution_time=execution_time,
94
+ timestamp=time.time(),
95
+ datetime=datetime.now().isoformat(),
96
+ )
97
+ session.add(data)
98
+ session.commit()
99
+ logger.debug(f"πŸ’Ύ Cached result for {func_name} to db")
100
+ return result
101
+
102
+ return wrapper
103
+
104
+ return decorator_db
105
+
106
+
107
+ def async_file_cache(
108
+ cache_dir: str | pathlib.Path = DIR_CACHE, expire_time: int | None = None, mode: Literal["db", "file"] = "db"
109
+ ):
110
+ """Decorator to cache async function results to local files.
111
+
112
+ Args:
113
+ cache_dir (str|pathlib.Path): Directory to store cache files
114
+ expire_time (Optional[int]): Cache expiration time in seconds, None means no expiration
115
+ """
116
+ cache_path = pathlib.Path(cache_dir)
117
+ cache_path.mkdir(exist_ok=True, parents=True)
118
+ if mode == "db" and SQLModelUtils.check_db_available():
119
+ return create_cached_db(expire_time)
120
+ else:
121
+ return create_cached_file(cache_path, expire_time)
@@ -0,0 +1,439 @@
1
+ Metadata-Version: 2.4
2
+ Name: youtu-agent
3
+ Version: 0.1.2
4
+ Summary: Youtu-Agent is a simple but powerful framework for building, running, and evaluating agents.
5
+ Project-URL: Homepage, https://github.com/TencentCloudADP/youtu-agent
6
+ Project-URL: Documentation, https://tencentcloudadp.github.io/youtu-agent/
7
+ Project-URL: Repository, https://github.com/TencentCloudADP/youtu-agent
8
+ Author-email: easonsshi <easonsshi@tencent.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agent,ai,automation,llm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.12
17
+ Requires-Dist: aiofiles>=24.1.0
18
+ Requires-Dist: aiohttp>=3.12.15
19
+ Requires-Dist: art>=6.5
20
+ Requires-Dist: arxiv>=2.2.0
21
+ Requires-Dist: chunkr-ai>=0.1.0
22
+ Requires-Dist: colorlog>=6.9.0
23
+ Requires-Dist: docker>=7.1.0
24
+ Requires-Dist: google-genai>=1.26.0
25
+ Requires-Dist: hydra-core>=1.3.2
26
+ Requires-Dist: ipython>=9.5.0
27
+ Requires-Dist: jinja2>=3.1.6
28
+ Requires-Dist: matplotlib>=3.10.3
29
+ Requires-Dist: mcp>=1.12.3
30
+ Requires-Dist: openai-agents==0.3.3
31
+ Requires-Dist: openinference-instrumentation-openai-agents>=1.1.1
32
+ Requires-Dist: openinference-instrumentation-openai>=0.1.30
33
+ Requires-Dist: openpyxl>=3.1.5
34
+ Requires-Dist: pandas>=2.3.0
35
+ Requires-Dist: pexpect>=4.9.0
36
+ Requires-Dist: prompt-toolkit>=3.0.52
37
+ Requires-Dist: psycopg2-binary>=2.9.10
38
+ Requires-Dist: python-pptx>=1.0.2
39
+ Requires-Dist: requests>=2.32.4
40
+ Requires-Dist: rich>=14.1.0
41
+ Requires-Dist: sqlmodel>=0.0.24
42
+ Requires-Dist: tiktoken>=0.9.0
43
+ Requires-Dist: toml>=0.10.2
44
+ Requires-Dist: wikipedia-api>=0.8.1
45
+ Provides-Extra: litllm
46
+ Requires-Dist: litellm>=1.77.0; extra == 'litllm'
47
+ Description-Content-Type: text/markdown
48
+
49
+ # <img src="docs/assets/logo.svg" alt="Youtu-agent Logo" height="24px"> Youtu-Agent: A simple yet powerful agent framework that delivers with open-source models
50
+
51
+ <div align="center">
52
+ <a href="https://tencentcloudadp.github.io/youtu-agent/"><img src=https://img.shields.io/badge/πŸ“–-Documentation-blue.svg></a>
53
+ <!-- <a href=https://arxiv.org/abs/2502.14345><img src=https://img.shields.io/badge/arXiv-2502.14345-b31b1b.svg></a> -->
54
+ <a href=https://github.com/TencentCloudADP/youtu-agent><img src=https://img.shields.io/badge/GitHub-Tencent-blue.svg></a>
55
+ <a href=https://deepwiki.com/TencentCloudADP/youtu-agent><img src=https://img.shields.io/badge/DeepWiki-Tencent-blue.svg></a>
56
+ <a href=https://arxiv.org/abs/2510.08191><img src=https://img.shields.io/badge/arXiv-2510.08191-b31b1b.svg></a>
57
+ </div>
58
+
59
+ <p align="center">
60
+ | <a href="README_ZH.md"><b>δΈ­ζ–‡</b></a>
61
+ | <a href="README_JA.md"><b>ζ—₯本θͺž</b></a>
62
+ | <a href="#-benchmark-performance"><b>🌟 Performance</b></a>
63
+ | <a href="#-examples"><b>πŸ’‘ Examples</b> </a>
64
+ | <a href="#-features"><b>✨ Features</b> </a>
65
+ | <a href="#-getting-started"><b>πŸš€ Getting Started</b> </a>
66
+ | πŸ“’ <a href="https://discord.gg/QjqhkHQVVM"><b>Join Discord</b></a> or <a href="https://github.com/user-attachments/assets/354cd8e7-e108-4348-9355-04440052f408"><b>WeChat</b></a>
67
+ |
68
+ </p>
69
+
70
+
71
+ `Youtu-Agent` is a flexible, high-performance framework for building, running, and evaluating autonomous agents. Beyond topping the benchmarks, this framework delivers powerful agent capabilities, e.g. data analysis, file processing, and deep research, all with open-source models.
72
+
73
+ <img src="docs/assets/mascot.png" alt="Youtu-agent Logo" width="200" align="left" style="margin-right:20px;">
74
+
75
+ Key highlights:
76
+ - **Verified performance**: Achieved 71.47% on WebWalkerQA (pass@1) and 72.8% on GAIA (text-only subset, pass@1), using purely `DeepSeek-V3` series models (without Claude or GPT), establishing a strong open-source starting point.
77
+ - **Open-source friendly & cost-aware**: Optimized for accessible, low-cost deployment without reliance on closed models.
78
+ - **Practical use cases**: Out-of-the-box support for tasks like CSV analysis, literature review, personal file organization, and podcast and video generation (coming soon).
79
+ - **Flexible architecture**: Built on [openai-agents](https://github.com/openai/openai-agents-python), with extensible support for diverse model APIs (form `DeepSeek` to `gpt-oss`), tool integrations, and framework implementations.
80
+ - **Automation & simplicity**: YAML-based configs, auto agent generation, and streamlined setup reduce manual overhead.
81
+
82
+ ## πŸ—žοΈ News
83
+
84
+ - πŸš€ [2025-10-10] [**Training-Free Group Relative Policy Optimization**](https://arxiv.org/abs/2510.08191). RL for DeepSeek-V3.2 at $8? Yes, it’s possible! Training-free GRPO keeps DeepSeek-V3.2 frozen, learns a token prior from ~100 samples for ~$8 RL runs, delivers verified math and web search gains! [code in branch [training_free_GRPO](https://github.com/TencentCloudADP/youtu-agent/tree/training_free_GRPO)] [[x thread](https://x.com/cai_cecilia47/status/1976558824640393559)].
85
+ - πŸ› οΈ [2025-09-28] Agent auto-generation now ships with companion tooling: describe a capability once and let `Youtu-Agent` build the tool for you. [[details](https://tencentcloudadp.github.io/youtu-agent/auto_generation/)].
86
+ - πŸ“Ί [2025-09-09] We hosted a live sharing the design philosophy and basic usage of `Youtu-Agent`. [[video](https://www.bilibili.com/video/BV1mypqz4EvS)] [[documentation](https://doc.weixin.qq.com/doc/w3_AcMATAZtAPICNLgt3CbnxRWaYWnW4)].
87
+ - 🎁 [2025-09-02] [Tencent Cloud International](https://www.tencentcloud.com/) offers new users of the DeepSeek API **3 million free tokens** (**Sep 1 – Oct 31, 2025**). [Try it out](https://www.tencentcloud.com/document/product/1255/70381) for free if you want to use DeepSeek models in `Youtu-Agent`! For enterprise agent solutions, also check out [Agent Development Platform](https://adp.tencentcloud.com) (ADP).
88
+ - πŸ“Ί [2025-08-28] We hosted a live sharing updates about DeepSeek-V3.1 and how to use it in the `Youtu-Agent` framework. [[video](https://www.bilibili.com/video/BV1XwayzrETi/)] [[documentation](https://doc.weixin.qq.com/doc/w3_AcMATAZtAPICNvcLaY5FvTOuo7MwF)].
89
+
90
+ ## 🌟 Benchmark Performance
91
+
92
+ `Youtu-Agent` is built on open-source models and lightweight tools, demonstrating strong results on challenging deep search and tool use benchmarks.
93
+
94
+ - **[WebWalkerQA](https://huggingface.co/datasets/callanwu/WebWalkerQA)**: Achieved 60.71% accuracy with `DeepSeek-V3-0324`, using new released `DeepSeek-V3.1` can further improve to 71.47%, setting a new SOTA performance.
95
+ - **[GAIA](https://gaia-benchmark-leaderboard.hf.space/)**: Achieved 72.8% pass@1 on the [text-only validation subset](https://github.com/sunnynexus/WebThinker/blob/main/data/GAIA/dev.json) using `DeepSeek-V3-0324` (including models used within tools). We are actively extending evaluation to the full GAIA benchmark with multimodal tools, and will release the trajectories in the near future. Stay tuned! ✨
96
+
97
+ ![WebWalkerQA](docs/assets/images/benchmark_webwalkerqa.png)
98
+
99
+ ## πŸ’‘ Examples
100
+
101
+ Click on the images to view detailed videos.
102
+
103
+ <table>
104
+ <tr>
105
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
106
+ <strong>Data Analysis</strong><br>Analyzes a CSV file and generates an HTML report.
107
+ </td>
108
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
109
+ <strong>File Management</strong><br>Renames and categorizes local files for the user.
110
+ </td>
111
+ </tr>
112
+ <tr>
113
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
114
+ <video src="https://github.com/user-attachments/assets/60193435-b89d-47d3-8153-5799d6ff2920"
115
+ poster="https://img.youtube.com/vi/r9we4m1cB6M/sddefault.jpg"
116
+ controls muted preload="metadata"
117
+ width="100%" height="300"
118
+ style="object-fit: cover; border-radius: 8px;"></video>
119
+ </td>
120
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
121
+ <video src="https://github.com/user-attachments/assets/dbb9cfc6-3963-4264-ba93-9ba21c5a579e"
122
+ poster="https://img.youtube.com/vi/GdA4AapE2L4/sddefault.jpg"
123
+ controls muted preload="metadata"
124
+ width="100%" height="300"
125
+ style="object-fit: cover; border-radius: 8px;"></video>
126
+ </td>
127
+ </tr>
128
+ <tr >
129
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
130
+ <strong>Wide Research</strong><br>Gathers extensive information to generate a comprehensive report, replicating the functionality of Manus.
131
+ </td>
132
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
133
+ <strong>Paper Analysis</strong><br>Parses a given paper, performs analysis, and compiles related literature to produce a final result.
134
+ </td>
135
+ </tr>
136
+ <tr>
137
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
138
+ <video src="https://github.com/user-attachments/assets/6fc75814-e565-4f94-9ab5-33e3e7788e92"
139
+ poster="https://img.youtube.com/vi/v3QQg0WAnPs/sddefault.jpg"
140
+ controls muted preload="metadata"
141
+ width="100%" height="300"
142
+ style="object-fit: cover; border-radius: 8px;"></video>
143
+ </td>
144
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
145
+ <video src="https://github.com/user-attachments/assets/09b24f94-30f0-4e88-9aaf-9f3bbf82e99d"
146
+ poster="https://img.youtube.com/vi/vBddCjjRk00/sddefault.jpg"
147
+ controls muted preload="metadata"
148
+ width="100%" height="300"
149
+ style="object-fit: cover; border-radius: 8px;"></video>
150
+ </td>
151
+ </tr>
152
+ </table>
153
+
154
+ > [!NOTE]
155
+ > See the [`examples`](./examples) directory and [documentation](https://tencentcloudadp.github.io/youtu-agent/examples/) for more details.
156
+
157
+ ### πŸ€– Automatic Tool and Agent Generation
158
+
159
+ A standout feature of `Youtu-Agent` is its ability to **automatically generate tools alongside agent configurations**. Other frameworks often make you hand-code functions or hand-craft prompts before an agent can even run. Here, you simply describe the task: the built-in meta-agent interviews you, assembles the necessary tools, produces YAML configs, and saves everything so you can execute it immediately.
160
+
161
+ ```bash
162
+ # Interactively clarify your requirements and auto-generate a config
163
+ python scripts/gen_simple_agent.py
164
+
165
+ # Run the generated config
166
+ python scripts/cli_chat.py --config generated/xxx
167
+ ```
168
+
169
+ <table>
170
+ <tr>
171
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
172
+ <strong>Automatic Agent Generation</strong><br>Interactively clarify your requirements, automatically generate the agent configuration, and run it right away.
173
+ </td>
174
+ <td style="border: 1px solid black; padding: 10px; width: 50%; vertical-align: top;">
175
+ <strong>Automatic Tool Generation</strong><br>Describe the behaviors you need, let the meta-agent draft tool code and schemas, then drop them straight into your workflow.
176
+ </td>
177
+ </tr>
178
+ <tr>
179
+ <td style="border: 1px solid black; padding:10px; vertical-align:top; width: 400px;">
180
+ <video src="https://github.com/user-attachments/assets/0c2ee833-507e-4141-8de4-148ff3d9f9ef"
181
+ poster="https://img.youtube.com/vi/JVpHDJtKBo8/maxresdefault.jpg"
182
+ controls muted preload="metadata"
183
+ width="100%" height="auto"
184
+ style="object-fit: cover; border-radius: 8px;"></video>
185
+ </td>
186
+ <td style="border: 1px solid black; padding:10px; vertical-align:top; width: 400px;">
187
+ <video src="https://github.com/user-attachments/assets/37878544-cfda-4a8a-9b42-a7361782c750"
188
+ poster="https://img.youtube.com/vi/zjGooBuqdSE/maxresdefault.jpg"
189
+ controls muted preload="metadata"
190
+ width="100%" height="auto"
191
+ style="object-fit: cover; border-radius: 8px;"></video>
192
+ </td>
193
+ </tr>
194
+ </table>
195
+
196
+ > [!NOTE]
197
+ > See [documentation](https://tencentcloudadp.github.io/youtu-agent/auto_generation/) for more details.
198
+
199
+ ## ✨ Features
200
+
201
+ ![features](docs/assets/images/header.png)
202
+
203
+ ### Design Philosophy
204
+ - **Minimal design**: We try to keep the framework simple and easy to use, avoiding unnecessary overhead.
205
+ - **Modular & configurable**: Flexible customization and easy integration of new components.
206
+ - **Open-source model support & low-cost**: Promotes accessibility and cost-effectiveness for various applications.
207
+
208
+ ### Core Features
209
+ - **Built on openai-agents**: Leveraging the foundation of [openai-agents](https://github.com/openai/openai-agents-python) SDK, our framework inherits streaming, tracing, and agent-loop capabilities, ensuring compatibility with both `responses` and `chat.completions` APIs for seamless adaptation to diverse models like [gpt-oss](https://github.com/openai/gpt-oss).
210
+ - **Fully asynchronous**: Enables high-performance and efficient execution, especially beneficial for evaluating benchmarks.
211
+ - **Tracing & analysis system**: Beyond OTEL, our `DBTracingProcessor` system provides in-depth analysis of tool calls and agent trajectories. (will be released soon)
212
+
213
+ ### Automation
214
+ - **YAML based configuration**: Structured and easily manageable agent configurations.
215
+ - **Automatic agent generation**: Based on user requirements, agent configurations can be automatically generated.
216
+ - **Tool generation & optimization**: Tool evaluation and automated optimization, and customized tool generation will be supported in the future.
217
+
218
+ ### Use Cases
219
+ - **Deep / Wide research**: Covers common search-oriented tasks.
220
+ - **Webpage generation**: Examples include generating web pages based on specific inputs.
221
+ - **Trajectory collection**: Supports data collection for training and research purposes.
222
+
223
+
224
+ ## πŸ€” Why Choose Youtu-Agent?
225
+
226
+ `Youtu-Agent` is designed to provide significant value to different user groups:
227
+
228
+ ### For Agents Researchers & LLM Trainers
229
+ - A **simple yet powerful baseline** that is stronger than basic ReAct, serving as an excellent starting point for model training and ablation studies.
230
+ - **One-click evaluation scripts** to streamline the experimental process and ensure consistent benchmarking.
231
+
232
+ ### For Agent Application Developers
233
+ - A **proven and portable scaffolding** for building real-world agent applications.
234
+ - **Ease of Use**: Get started quickly with simple scripts and a rich set of built-in toolkits.
235
+ - **Modular Design**: Key components like `Environment` and `ContextManager` are encapsulated yet highly customizable.
236
+
237
+ ### For AI & Agent Enthusiasts
238
+ - **Practical Use Cases**: The `/examples` directory includes tasks like deep research report generation, data analysis, and personal file organization.
239
+ - **Simplicity & Debuggability**: A rich toolset and visual tracing tools make development and debugging intuitive and straightforward.
240
+
241
+
242
+ ## 🧩 Core Concepts
243
+
244
+ - **Agent**: An LLM configured with specific prompts, tools, and an environment.
245
+ - **Toolkit**: An encapsulated set of tools that an agent can use.
246
+ - **Environment**: The world in which the agent operates (e.g., a browser, a shell).
247
+ - **ContextManager**: A configurable module for managing the agent's context window.
248
+ - **Benchmark**: An encapsulated workflow for a specific dataset, including preprocessing, rollout, and judging logic.
249
+
250
+ For more design and implementation details, please refer to our [technical documentation](https://tencentcloudadp.github.io/youtu-agent/).
251
+
252
+ ## πŸš€ Getting Started
253
+
254
+ Youtu-Agent provides complete code and examples to help you get started quickly. Follow the steps below to run your first agent, or refer to [`docker/README.md`](./docker/README.md) for a streamlined Docker-based setup with interactive frontend.
255
+
256
+ ### Setup
257
+
258
+ #### Source Code Deployment
259
+
260
+ > [!NOTE]
261
+ > The project requires Python 3.12+. We recommend using [uv](https://github.com/astral-sh/uv) for dependency management.
262
+
263
+ First, make sure Python and uv are installed.
264
+
265
+ Then clone the repository and sync dependencies:
266
+
267
+ ```bash
268
+ git clone https://github.com/TencentCloudADP/youtu-agent.git
269
+ cd youtu-agent
270
+ uv sync # or, `make sync`
271
+ source ./.venv/bin/activate
272
+ cp .env.example .env # NOTE: You should then config the necessary API keys.
273
+ ```
274
+
275
+ After copying the `.env.example` file, you need to fill in the necessary keys in the `.env` file, e.g. LLM API keys. For example:
276
+
277
+ ```bash
278
+ # llm requires OpenAI API format compatibility
279
+ # setup your LLM config , ref https://api-docs.deepseek.com/
280
+ UTU_LLM_TYPE=chat.completions
281
+ UTU_LLM_MODEL=deepseek-chat
282
+ UTU_LLM_BASE_URL=https://api.deepseek.com/v1
283
+ UTU_LLM_API_KEY=replace-to-your-api-key
284
+ ```
285
+
286
+ > [Tencent Cloud International](https://www.tencentcloud.com/) offers new users of the DeepSeek API **3 million free tokens** (**Sep 1 – Oct 31, 2025**). [Try it out](https://www.tencentcloud.com/document/product/1255/70381) for free. Once you’ve applied, replace the API key in the .env file below:
287
+
288
+ ```bash
289
+ # llm
290
+ # setup your LLM config , ref https://www.tencentcloud.com/document/product/1255/70381
291
+ UTU_LLM_TYPE=chat.completions
292
+ UTU_LLM_MODEL=deepseek-v3
293
+ UTU_LLM_BASE_URL=https://api.lkeap.cloud.tencent.com/v1
294
+ UTU_LLM_API_KEY=replace-with-your-api-key
295
+ ```
296
+
297
+ #### Docker Deployment
298
+
299
+ Please refer to [`docker/README.md`](./docker/README.md) for a streamlined Docker-based setup with interactive frontend.
300
+
301
+ ### Quick Start
302
+
303
+ Youtu-agent ships with built-in configurations. For example, the config `configs/agents/simple/base_search.yaml` defines a simple agent equipped with a search tool:
304
+
305
+ ```yaml
306
+ defaults:
307
+ - /model/base
308
+ - /tools/search@toolkits.search
309
+ - _self_
310
+
311
+ agent:
312
+ name: simple-tool-agent
313
+ instructions: "You are a helpful assistant that can search the web."
314
+ ```
315
+
316
+ You can launch an interactive CLI chatbot with this agent by running:
317
+
318
+ ```bash
319
+ # NOTE: You need to set `SERPER_API_KEY` and `JINA_API_KEY` in `.env` for web search access.
320
+ # (We plan to replace these with free alternatives in the future)
321
+ python scripts/cli_chat.py --config simple/base_search
322
+ # To avoid using the search toolkit, you can run:
323
+ python scripts/cli_chat.py --config simple/base
324
+ ```
325
+
326
+ πŸ“– More details: [Quickstart Documentation](https://tencentcloudadp.github.io/youtu-agent/quickstart)
327
+
328
+ ### Explore More Examples
329
+
330
+ The repository provides multiple ready-to-use examples. Some examples require the agent to have internet search capabilities, so you’ll need to configure the tool APIs in the `.env` file under the tools module:
331
+
332
+ ```bash
333
+ # tools
334
+ # serper api key, ref https://serper.dev/playground
335
+ SERPER_API_KEY=<Access the URL in the comments to get the API Key>
336
+ # jina api key, ref https://jina.ai/reader
337
+ JINA_API_KEY=<Access the URL in the comments to get the API Key>
338
+ ```
339
+
340
+ For example, to enable the agent to automatically search online for information and generate an SVG image on the topic of β€œDeepSeek V3.1 New Features,” run the following command:
341
+
342
+ ```bash
343
+ python examples/svg_generator/main.py
344
+ ```
345
+
346
+ If you want to visualize the agent’s runtime status using the web UI, download the frontend package from the Youtu-Agent releases and install it locally:
347
+
348
+ ```bash
349
+ # Download the frontend package
350
+ curl -LO https://github.com/Tencent/Youtu-agent/releases/download/frontend%2Fv0.2.0/utu_agent_ui-0.2.0-py3-none-any.whl
351
+
352
+ # Install the frontend package
353
+ uv pip install utu_agent_ui-0.2.0-py3-none-any.whl
354
+ ```
355
+
356
+ Next, run the web version of the SVG image generation command:
357
+
358
+ ```bash
359
+ python examples/svg_generator/main_web.py
360
+ ```
361
+
362
+ Once the terminal shows the following message, the deployment is successful. You can access the project by clicking the local link:
363
+
364
+ ```bash
365
+ Server started at http://127.0.0.1:8848/
366
+ ```
367
+
368
+ ![svg_generator_ui](https://github.com/user-attachments/assets/337d327f-91ee-434e-bbcf-297dd4b26c28)
369
+
370
+ Given a research topic, the agent will automatically search the web, collect relevant information, and output an SVG visualization.
371
+
372
+ ![svg_generator_result](https://github.com/user-attachments/assets/41aa7348-5f02-4daa-b5b2-225e35d21067)
373
+
374
+ πŸ“– Learn more: [Examples Documentation](https://tencentcloudadp.github.io/youtu-agent/examples)
375
+
376
+ ### Run Evaluations
377
+
378
+ Youtu-Agent also supports benchmarking on standard datasets. For example, to evaluate on `WebWalkerQA`:
379
+
380
+ ```bash
381
+ # Prepare dataset. This script will download and process WebWalkerQA dataset, and save it to DB.
382
+ python scripts/data/process_web_walker_qa.py
383
+
384
+ # Run evaluation with config `ww.yaml` with your custom `exp_id`. We choose the sampled small dataset `WebWalkerQA_15` for quick evaluation.
385
+ # NOTE: `JUDGE_LLM_TYPE, JUDGE_LLM_MODEL, JUDGE_LLM_BASE_URL, JUDGE_LLM_API_KEY` should be set in `.env`. Ref `.env.full`.
386
+ python scripts/run_eval.py --config_name ww --exp_id <your_exp_id> --dataset WebWalkerQA_15 --concurrency 5
387
+ ```
388
+
389
+ Results are stored and can be further analyzed in the evaluation platform. See [Evaluation Analysis](./frontend/exp_analysis/README.md).
390
+
391
+ ![eval_analysis_overview](https://github.com/user-attachments/assets/4a285b9e-d096-437e-9b8e-e5bf6b1924b6)
392
+
393
+ ![eval_analysis_detail](https://github.com/user-attachments/assets/4ede525a-5e16-4d88-9ebb-01a7dca3aaec)
394
+
395
+ πŸ“– Learn more: [Evaluation Documentation](https://tencentcloudadp.github.io/youtu-agent/eval)
396
+
397
+ ## πŸ“– Dive Deeper
398
+
399
+ After getting started, you can learn more about the framework and its capabilities through our full documentation:
400
+
401
+ - πŸ“– **[Full Documentation](https://tencentcloudadp.github.io/youtu-agent/)**: Explore the core concepts, architecture, and advanced features.
402
+ - πŸš€ **[Quickstart Guide](https://tencentcloudadp.github.io/youtu-agent/quickstart/)**: A detailed guide to get you up and running.
403
+ - ❓ **[FAQ](https://tencentcloudadp.github.io/youtu-agent/faq)**: Find answers to common questions and issues.
404
+
405
+ ## πŸ™ Acknowledgements
406
+
407
+ This project builds upon the excellent work of several open-source projects:
408
+ - [openai-agents](https://github.com/openai/openai-agents-python)
409
+ - [mkdocs-material](https://github.com/squidfunk/mkdocs-material)
410
+ - [model-context-protocol](https://github.com/modelcontextprotocol/python-sdk)
411
+
412
+ ## πŸ™Œ Contributing
413
+
414
+ We welcome contributions from the community! If you'd like to help improve Youtu-Agent, please read our [**Contributing Guidelines**](./CONTRIBUTING.md) to get started.
415
+
416
+ ## πŸ“š Citation
417
+
418
+ If you find this work useful, please consider citing:
419
+
420
+ ```bibtex
421
+ @misc{training_free_grpo,
422
+ title={Training-Free Group Relative Policy Optimization},
423
+ author={Tencent Youtu Lab},
424
+ year={2025},
425
+ eprint={2510.08191},
426
+ archivePrefix={arXiv},
427
+ primaryClass={cs.CL},
428
+ url={https://arxiv.org/abs/2510.08191},
429
+ }
430
+
431
+ @misc{youtu-agent-2025,
432
+ title={Youtu-agent: A Simple yet Powerful Agent Framework},
433
+ author={Tencent Youtu Lab},
434
+ year={2025},
435
+ publisher = {GitHub},
436
+ journal = {GitHub repository},
437
+ howpublished = {\url{https://github.com/TencentCloudADP/youtu-agent}},
438
+ }
439
+ ```