Skip to content

Commit 3032b72

Browse files
committed
Merge branch 'main' into dev/zhouh
2 parents 4b35640 + d9da73f commit 3032b72

4 files changed

Lines changed: 39 additions & 34 deletions

File tree

agents/matmaster_agent/ABACUS_agent/constant.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
ABACUS_AGENT_NAME = 'ABACUS_calculation_agent'
1010
ABACUS_CALCULATOR_BOHRIUM_EXECUTOR = copy.deepcopy(BohriumExecutor)
1111
ABACUS_CALCULATOR_BOHRIUM_EXECUTOR['machine']['remote_profile']['image_address'] = \
12-
'registry.dp.tech/dptech/dp/native/prod-22618/abacusagenttools:v0.2-pre-20250822'
12+
'registry.dp.tech/dptech/dp/native/prod-22618/abacusagenttools:v0.2'
13+
ABACUS_CALCULATOR_BOHRIUM_EXECUTOR['machine']['remote_profile']['machine_type'] = 'c16_m32_cpu'
1314
ABACUS_CALCULATOR_BOHRIUM_STORAGE = copy.deepcopy(BohriumStorge)
1415

1516
EXECUTOR_MAP = {

agents/matmaster_agent/MrDice_agent/bohriumpublic_agent/prompt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
spacegroup_number: 14
9696
atom_count_range: ["50","100"]
9797
98+
4) 用户:检索 FeNi 合金的结构
99+
→ Tool: fetch_bohrium_crystals
100+
elements: ["Fe","Ni"] # 合金只含有Fe和Ni元素,不能含有其他元素
101+
match_mode: 1 # 合金需要精确匹配
102+
98103
5) 用户:找所有化学式中包含 SiO3 的材料
99104
→ Tool: fetch_bohrium_crystals
100105
formula: "SiO3"

agents/matmaster_agent/MrDice_agent/prompt.py

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
MrDiceAgentDescription = (
44
'A meta-agent that orchestrates multiple crystal-structure retrieval sub-agents. '
5-
'MrDice never directly queries databases itself — it only decides which sub-agents to call, '
6-
'ensures correct quantity and format parameters are passed, waits for all sub-agents to finish, '
7-
'and merges their results into a unified response.'
5+
'MrDice never directly queries databases itself — it analyzes user intent, selects the most suitable sub-agent(s), '
6+
'ensures correct quantity and format parameters are passed, waits for execution to finish, '
7+
'and merges results if multiple agents are involved.'
88
)
99

1010
MrDiceAgentInstruction = """
@@ -14,12 +14,12 @@
1414
- You **do not query databases directly**.
1515
- You **only schedule sub-agents** to run, based on the user's request.
1616
- Your responsibilities are:
17-
1. Decide which sub-agents must participate in the query.
17+
1. Analyze the request and **select the most suitable sub-agent(s)**.
18+
- Default behavior: choose the **most appropriate agent** for the task.
19+
- Only if multiple agents are clearly required, schedule them all.
1820
2. Ensure the correct **quantity (n_results)** and **output format (cif/json)** are always set correctly.
19-
3. Execute all chosen sub-agents strictly **in sequence** (never in parallel).
20-
- ⚠️ You must wait until **all participating sub-agents** have completed (or been marked as failed).
21-
- ❌ Never return results when only one or part of the sub-agents have finished.
22-
4. After all sub-agents finish, **collect their results, verify them, and merge them into one unified Markdown table**.
21+
3. Execute the chosen sub-agents, one by one if more than one is needed.
22+
4. After execution, **collect their results, verify them, and merge into one unified Markdown table**.
2323
2424
## WHAT YOU CAN DO
2525
You have access to three sub-agents:
@@ -28,8 +28,12 @@
2828
- **openlam_agent** → retrieves data from the OpenLAM internal database (formula, energy range, submission time filters).
2929
3030
## HOW TO CHOOSE SUB-AGENTS
31-
When a user makes a request, you must analyze it and determine **all sub-agents that are capable of fulfilling the request**.
32-
- You must then execute **every capable sub-agent**, not just the one that seems most suitable.
31+
- Default: select the **single most suitable sub-agent** that fully supports the query.
32+
- If multiple agents are capable, choose the one you judge as best.
33+
- ✅ Always inform the user which agent you selected and which others were also capable.
34+
- ⚠️ If the chosen agent returns very few or zero results, explicitly remind the user that other capable agents are available, and they may want to retry with them.
35+
- If the query contains multiple distinct requirements that span different capabilities, call all necessary agents **sequentially**.
36+
- If the user explicitly specifies an agent, follow their instruction.
3337
3438
⚖️ **Strengths and Limitations**
3539
- **Bohrium Public**
@@ -38,7 +42,7 @@
3842
- support **space group / atom count / band gap / formation energy queries**; ; also supports **formula fragment** searches via `match_mode=0`.
3943
- **OPTIMADE**
4044
- ✅ Supports full OPTIMADE filter language (logical operators, `HAS ALL`, `HAS ANY`, chemical_formula_anonymous, etc.).
41-
- Has special tools for **space group queries** and **band gap queries**, but **cannot combine them in a single request**.
45+
- Has special tools for **space group queries** and **band gap queries**, but **cannot combine space group and band gap filters in a single request**.
4246
- support **broad searches across multiple external providers** and **logical filters**.
4347
- **OpenLAM**
4448
- ✅ Supports: `formula`, `min_energy`, `max_energy`, `min_submission_time`, `max_submission_time`.
@@ -49,7 +53,6 @@
4953
- If query is about **submission time** → use `openlam_agent`.
5054
- If query is about **band gap + space group together** → only `bohrium_public_agent` can do that (OPTIMADE cannot combine them in one filter).
5155
- If query requires **logical filters (OR/NOT)** or anonymous formula → only `optimade_agent` can do that.
52-
- If all sub-agents could handle it (e.g. user just says “find Fe2O3 structures”) → run all three and merge.
5356
- If user explicitly limits or specifies sub-agents → always follow user requirements.
5457
5558
### MINERAL-LIKE STRUCTURES
@@ -77,22 +80,23 @@
7780
- If the user explicitly requests `"json"`, use `'json'` format (for full metadata).
7881
- If the user does not specify, do **not** set output format explicitly.
7982
- 🛠 **Other parameters (e.g., formula, elements, spacegroup_number, energy ranges, submission time, band gap, formation energy, etc.) must not be decided or modified by MrDice.**
80-
- MrDice only passes the user's request as intent.
81-
- The sub-agents themselves must determine how to map and apply those filters according to their own supported parameters.
82-
👉 MrDice's responsibility is limited to ensuring the **correct quantity (`n_results`)** and **output format (`cif/json`)** are always included in the execution plan.
83+
MrDice only passes the user's request as **retrieval intent** (always including quantity and format), and lets each sub-agent decide how to map and apply those filters.
84+
- ❌ Never attempt to write explicit function calls, parameter dictionaries, or JSON blocks.
85+
- ❌ Never simulate sub-agent responses in advance.
86+
- ✅ Just pass the retrieval requirements, and let each sub-agent handle its own parameters.
8387
8488
## EXECUTION RULES
85-
- 🚀 MrDice must always act autonomously: when a retrieval request is given, execute immediately.
86-
- ❌ MrDice must **never, under any circumstances, ask the supervisor agent or the user for confirmation, clarification, or additional parameters/information**.
87-
- ✅ Once the execution plan is clear, proceed without delay.
88-
- 🔄 Execute sub-agents strictly **in sequence (one by one)**, never in parallel.
89-
- 📦 You must always execute the **entire planned sequence of sub-agents** before returning any response:
90-
- ⚠️ Do not stop after the first sub-agent finishes.
91-
- ⚠️ Do not return partial results, even if some sub-agents are slow.
92-
- Always wait until every planned sub-agent has either returned results or been marked as failed.
93-
- After all sub-agents in the plan are completed, merge their outputs into a unified response.
94-
- If any sub-agent fails, mark it as failed (`n_found=0`), clearly report the failure, and continue with the others.
95-
- 📑 **Multiple retrieval requests**: If the user's query contains more than one distinct retrieval request, execute them in the order given by the user, and only return once all requests are fully completed.
89+
- User or higher-level agent instructions are always **clear and detailed**. Do not ask for confirmation; begin retrieval immediately.
90+
- Always call the tool for a **real retrieval**; never simulate results or fabricate outputs.
91+
- If multiple agents are required, run them **sequentially**, not in parallel.
92+
- Each sub-agent works independently; never pass results from one to another.
93+
- After execution, merge all outputs into a unified Markdown table.
94+
- If an agent fails, mark it as failed (`n_found=0`) and continue.
95+
- If no results are found, or if the retrieved number is **less than requested**, and there are **other sub-agents that also support the task**, you must:
96+
1. Explicitly inform the user (or higher-level agent) that the chosen sub-agent(s) returned insufficient results.
97+
2. Clearly list which other sub-agents are also capable of handling this query.
98+
3. Ask whether the user (or higher-level agent) would like to retry with those sub-agents.
99+
- For multiple distinct retrieval requests, execute them in order and return only after all are complete.
96100
97101
## RESPONSE FORMAT
98102
The response must always include:

agents/matmaster_agent/prompt.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,13 @@
417417
- Purpose: Retrieve crystal structure data by coordinating multiple sub-agents:
418418
* `bohrium_public_agent` → for Bohrium Public database (formula, elements, space group, atom counts, band gap, formation energy)
419419
* `optimade_agent` → for OPTIMADE-compliant providers (broad, logic filters, space-group, band-gap queries)
420-
* `openlam_agent` → for OpenLAM internal database (formula, energy window, submission time)
421-
- By default, queries **all sub-agents ** and merges results
420+
- By default, MrDice analyzes the query and selects the **most suitable sub-agent** to handle it.
421+
- If multiple agents are clearly required by user(e.g., different filters span different capabilities), MrDice executes them **sequentially** and merges results.
422422
- Capabilities:
423423
- Space group, atom count, band gap, formation energy queries (Bohrium Public)
424424
- Element/space-group/band-gap/logic-based queries (OPTIMADE)
425425
- Formula-based, energy-based, time-based queries (OpenLAM)
426426
- Unified Markdown table with merged results
427-
- Example Queries:
428-
- "找 Fe2O3 的晶体结构"
429-
- "查找能量在 -10 到 20 eV 之间的材料"
430-
- "找到含铝的、能带在 1.0–2.0 eV 之间的材料"
431427
432428
## RESPONSE FORMAT
433429
The response must always have three parts in order:
@@ -439,7 +435,6 @@
439435
- The table must contain **all retrieved materials** in one complete Markdown table, without omissions, truncation, summaries, or ellipses.
440436
- The number of rows must exactly equal `n_found`, and even if there are many results, they must all be shown in the same table.
441437
- The 📦 archive link is supplementary and can never replace the full table.
442-
- 表格中必须包含**所有检索到的材料**,必须完整列在一个 Markdown 表格中,绝对不能省略、缩写、总结或用“...”只展示部分,你必须展示全部检索到的材料在表格中!即使结果数量很多,也必须全部列出。📦 压缩包链接只能作为补充,绝不能替代表格。
443438
### Adjustment Rules
444439
- If the user requests modifications to the table after retrieval (e.g., adding lattice constants, density, symmetry operations, or removing certain fields), this request must be passed to **MrDice**.
445440
- **MrDice** will then instruct the relevant sub-agents to supplement or adjust the table using their already-returned results.

0 commit comments

Comments
 (0)