-
Notifications
You must be signed in to change notification settings - Fork 299
feat(benchmark): add xbench-ds prep support and add_new_tools doc #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xuan-dong-shanda
merged 3 commits into
MiroMindAI:miroflow-v0.3
from
xuan-dong-shanda:miroflow-v0.3
Sep 17, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,76 @@ | ||
| # Adding New Tools | ||
|
|
||
| # - Coming Soon - | ||
| ## What This Does | ||
| Extend the agent’s functionality by introducing a new tool. Each tool is implemented as an MCP server and registered via configuration. | ||
|
|
||
| ## Implementation Steps | ||
|
|
||
| ### 1. Create MCP Server | ||
| Create a new file `src/tool/mcp_servers/new-mcp-server.py` that implements the tool’s core logic. | ||
|
|
||
| ```python | ||
| from fastmcp import FastMCP | ||
|
|
||
| # Initialize FastMCP server | ||
| mcp = FastMCP("new-mcp-server") | ||
|
|
||
| @mcp.tool() | ||
| async def tool_name(param: str) -> str: | ||
| """ | ||
| Explanation of the tool, its parameters, and return value. | ||
| """ | ||
| tool_result = ... # Your logic here | ||
| return tool_result | ||
|
|
||
| if __name__ == "__main__": | ||
| mcp.run(transport="stdio") | ||
| ``` | ||
|
|
||
| > Tool schemas are automatically generated from `docstrings` and `hints` via the FastMCP protocol. | ||
|
|
||
|
|
||
| ### 2. Create Tool Config | ||
| Add a new config file at `config/tools/new-tool-name.yaml`: | ||
|
|
||
| ```yaml | ||
| name: "new-tool-name" | ||
| tool_command: "python" | ||
| args: | ||
| - "-m" | ||
| - "src.tool.mcp_servers.new-mcp-server" # Match the server file created above | ||
| ``` | ||
|
|
||
|
|
||
| ### 3. Register Tool in Agent Config | ||
| Enable the new tool inside your agent config (e.g., `config/agent-with-new-tool.yaml`): | ||
|
|
||
| ```yaml | ||
| main_agent: | ||
| ... | ||
| tool_config: | ||
| - tool-reasoning | ||
| - new-tool-name # 👈 Add your new tool here | ||
| ... | ||
| sub_agents: | ||
| agent-worker: | ||
| ... | ||
| tool_config: | ||
| - tool-searching | ||
| - tool-image-video | ||
| - tool-reading | ||
| - tool-code | ||
| - tool-audio | ||
| - new-tool-name # 👈 Add your new tool here | ||
| ... | ||
| ``` | ||
|
|
||
|
|
||
| ## Examples | ||
| - `tool-reasoning` – reasoning utilities | ||
| - `tool-image-video` – visual understanding | ||
| - `new-tool-name` – your custom tool | ||
|
|
||
| --- | ||
|
|
||
| **Last Updated:** Sep 2025 | ||
| **Doc Contributor:** Team @ MiroMind AI | ||
| **Doc Contributor:** Team @ MiroMind AI | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # SPDX-FileCopyrightText: 2025 MiromindAI | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import base64 | ||
| from typing import Generator, MutableMapping | ||
|
|
||
| from datasets import load_dataset | ||
|
|
||
| from utils.prepare_benchmark.common import Task | ||
|
|
||
|
|
||
| def xor_decrypt(data, key): | ||
| """ | ||
| XOR decrypt data with a key | ||
| """ | ||
| key_bytes = key.encode('utf-8') | ||
| key_length = len(key_bytes) | ||
| return bytes([data[i] ^ key_bytes[i % key_length] for i in range(len(data))]) | ||
|
|
||
| def gen_xbench_ds(hf_token: str) -> Generator[Task, None, None]: | ||
| dataset = load_dataset( | ||
| "xbench/DeepSearch", | ||
| split="train", | ||
| ) | ||
| for x in dataset: | ||
| metadata: MutableMapping = x # type: ignore | ||
| task_id = metadata.pop("id") | ||
|
|
||
| key = metadata.pop("canary") | ||
| prompt = xor_decrypt(base64.b64decode(metadata.pop("prompt")), key).decode('utf-8') | ||
| answer = xor_decrypt(base64.b64decode(metadata.pop("answer")), key).decode('utf-8') | ||
| reference_steps = xor_decrypt(base64.b64decode(metadata.pop("reference_steps")), key).decode('utf-8') | ||
| task = Task( | ||
| task_id=task_id, | ||
| task_question=prompt, | ||
| ground_truth=answer, | ||
| file_path=None, | ||
| metadata={"reference_steps": reference_steps}, | ||
| ) | ||
| yield task | ||
|
|
||
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xuan-dong-shanda can put name/nickname if wanted :)