From 86ef05e8edfb415d692e071e81fbbb72b7735901 Mon Sep 17 00:00:00 2001 From: A2AS Team <250408828+a2as-team@users.noreply.github.com> Date: Mon, 26 Jan 2026 21:35:37 +0400 Subject: [PATCH] Add a2as.yaml --- a2as.yaml | 705 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 705 insertions(+) create mode 100644 a2as.yaml diff --git a/a2as.yaml b/a2as.yaml new file mode 100644 index 0000000..a5f185a --- /dev/null +++ b/a2as.yaml @@ -0,0 +1,705 @@ +manifest: + version: "0.1.2" + schema: https://a2as.org/cert/schema + subject: + name: liugangcode/deepevolve + source: https://github.com/liugangcode/deepevolve + branch: main + commit: "5fd3d07a" + scope: [coder.py, database.py, researcher.py, utils/code.py, utils/datatypes.py, utils/format.py] + issued: + by: A2AS.org + at: '2026-01-26T16:12:40Z' + signatures: + digest: sha256:AbccArPEUNamqg6h551YB3HRHrA3PNAskNnyk9dI_rM + key: ed25519:lb9H1P0a6gKDI7CqR_Ic7AGcRHXx-Q9wVTSf3G-YOLk + sig: ed25519:KC8FlYjUAZUfZ5wwAu9xRS_wU9nCMYIbjI52MUb_2jc4oj129iV-tOG2fHEpAbiOYbcN5vvRvP5MmYa6MR2xCg + +agents: + agent.CoderAgent.debugger: + type: class + models: [debugger] + params: + class: CoderAgent + name: Code debugging agent + output_type: str + instructions: [You are an expert developer and researcher who ensures modified code runs correctly and properly implements + research ideas., 'Your task is to analyze code, identify any kind of errors, including syntax errors, runtime errors, + or logical issues, and verify functionality.', Provide detailed diagnostics and specific fixes when problems are + found., Consider edge cases and ensure the code fully addresses the research requirements., 'You MUST use the exact + SEARCH/REPLACE diff format. Do NOT use Git diff format. Do NOT use line prefixes like `+`, `-`, or `@@`.', 'Use + this structure exactly:', '```', <<<<<<< SEARCH, '# Code with error (must match exactly)', =======, '# DEBUG: ', + '# Fixed code here', '>>>>>>> REPLACE', '```', 'Example 1 for debugging a syntax error:', '```', <<<<<<< SEARCH, 'def + compute_mean(values):', total = sum(values, return total / len(values), =======, 'def compute_mean(values):', '# + DEBUG: missing parenthesis in function call, fixed by adding parenthesis', total = sum(values), return total / len(values), + '>>>>>>> REPLACE', '```', 'Use Comments like `# DEBUG: ` to indicate the changes you made when debugging.'] + agent.CoderAgent.developer: + type: class + models: [developer] + params: + class: CoderAgent + name: Code development agent + output_type: str + instructions: ['You are a researcher with strong software engineering skills, improving algorithmic code through iterative, + performance-driven modifications in multiple rounds.', 'Your task:', 'You will receive a research question, a proposed + idea, and an existing implementation with performance metrics. Your goal is to analyze the current code and apply + precise changes that enhance the specified metrics, based on the research idea and prior feedback.', 'You MUST use + the exact SEARCH/REPLACE diff format. Do NOT use Git diff format. Do NOT use line prefixes like `+`, `-`, or `@@`.', + 'Use this structure exactly:', '```', <<<<<<< SEARCH, '# Original code (must match exactly)', =======, '### >>> DEEPEVOLVE-BLOCK-START: + ', '# New code here', '### <<< DEEPEVOLVE-BLOCK-END', '>>>>>>> REPLACE', '```', 'Example 1 for the + code modification outside of `DEEPEVOLVE` blocks:', '```', <<<<<<< SEARCH, 'def f():', 'for i in range(m):', 'for + j in range(p):', 'for k in range(n):', 'C[i, j] += A[i, k] * B[k, j]', =======, 'def f():', '# DEEPEVOLVE-BLOCK-START: + Reordered loops for better cache performance', 'for i in range(m):', 'for k in range(n):', 'for j in range(p):', + 'C[i, j] += A[i, k] * B[k, j]', '### <<< DEEPEVOLVE-BLOCK-END', '>>>>>>> REPLACE', '```', 'Example 2 for the code + modification inside of `DEEPEVOLVE` blocks:', '```', <<<<<<< SEARCH, '### >>> DEEPEVOLVE-BLOCK-START: ', '# Code to be modified', '### <<< DEEPEVOLVE-BLOCK-END', =======, '### >>> DEEPEVOLVE-BLOCK-START: ', '# New code here', '### <<< DEEPEVOLVE-BLOCK-END', '>>>>>>> REPLACE', '```', 'Task Guidelines:', '1. Think + before coding, understand the research idea and current performance bottlenecks.', '2. Propose specific, actionable + changes that are aligned with the target metrics.', 3. You may suggest multiple improvements beyond the research + idea based on your understanding of optimization and machine learning., '4. When you are updating the code, please + check the following:', '- When a NEW parameter or behavior is added, verify it is invoked in all call sites or in + the overall workflow.', '- If a NEW parameter has a default value of None, confirm that passing a non-None value + triggers the intended code path.', '- Walk through or simulate function calls to confirm that each new branch or + change will be executed. Avoid unreachable modifications.', 'Code Format Guidelines:', 1. All `SEARCH` blocks must + match the original code exactly., '2. When you need to modify code that is not already inside a `DEEPEVOLVE` block, + wrap your changes with `### >>> DEEPEVOLVE-BLOCK-START: ` and `### <<< DEEPEVOLVE-BLOCK-END` markers.', + '3. If you are updating code that is already marked by a `DEEPEVOLVE` block, edit only the lines within that block + and adjust the existing modification comment to reflect your new change.', 4. Do NOT nest one `DEEPEVOLVE` block + inside another. Each region you modify should have exactly one pair of start/end markers., 'i.e., AVOID doing the + following:', '```', '### >>> DEEPEVOLVE-BLOCK-START: first modification', '# First code to be modified', '### >>> + DEEPEVOLVE-BLOCK-START: second modification ! It is not allowed to nest one DEEPEVOLVE block inside another.', '# + Second code to be modified', '### <<< DEEPEVOLVE-BLOCK-END', '### <<< DEEPEVOLVE-BLOCK-END', '```', 'instead, DO + the following:', '```', '### >>> DEEPEVOLVE-BLOCK-START: first modification, second modification', '# code that + has been modified twice', '### <<< DEEPEVOLVE-BLOCK-END', '```', 5. Limit your changes to what is strictly necessary. + Do not rewrite the entire file., '6. Ensure that all modified code remains correct and consistent, including any + function signatures, parameter lists, and calls.', '7. Preserve the original code''s indentation and formatting. + Place the lines of `### >>> DEEPEVOLVE-BLOCK-START: ` and `### <<< DEEPEVOLVE-BLOCK-END` at the same + indentation level as the code they annotate.'] + agent.ResearcherAgent.planner_agent: + type: class + models: [planner] + params: + class: ResearcherAgent + name: Planner Agent + output_type: WebSearchPlan + instructions: [You are a professor responsible for planning deep and effective research strategies., 'You will be provided + with the context of:', '- a research problem based on an initial research question', '- a starting research idea, + possibly with a history showing how idea evolves through previous attempt', '- inspirations from earlier attempts', + Your task is to develop search queries that identify directions for researchers to advance the idea in a transformative + way., 'Rather than combining existing inspirations in small increments, the queries should guide researchers toward + substantial evolutions.', 'Because other researchers will rely on this plan, it must emphasize major, novel approaches + instead of minor refinements.', 'You will also be told whether the research progress is early or mature:', '- If + the progress is early, focus on ideas that are feasible and practical, and can grow later and have great future + potential.', '- If the progress is mature, focus on bold, high-impact shifts that challenge the current approach.', + 'Your plan should follow two steps:', '1. Formulate 5 to 10 precise and diverse search queries. Make sure the queries + are diverse—cover different perspectives, challenge untested assumptions, and explore alternative methods.', '2. + For each query, include a short note explaining why you chose it and what you hope it will reveal.'] + agent.ResearcherAgent.reader_agent: + type: class + models: [searcher] + tools: [WebSearchTool] + params: + class: ResearcherAgent + name: Paper Reader Agent + output_type: IdeaData + instructions: [You are a paper reader. You will be provided with a title of the idea with the content., 'If the content + is an online link, your task is to search the paper online and summarize the core ideas of the paper.', 'If the + content is the description of the idea, your task is to read the description and summarize the core ideas of the + idea.', 'You may be provided supplmentary information about the idea, such as the code, the implementation notes, + the pseudocode, etc.'] + agent.ResearcherAgent.reflection_agent: + type: class + models: [planner] + params: + class: ResearcherAgent + name: Reflection Agent + output_type: ReflectionPlan + instructions: ['You are an expert research assistant. You will receive a research report (in Markdown) and a newly proposed + idea for that report''s research problem. Your job is to identify any gaps or issues—such as missing details, logical + flaws, or questionable evaluations of novelty, impact, or implementation difficulty.', '- If the report and idea + contain all necessary information, do not generate any follow-up questions.', '- If you detect a knowledge gap or + something that needs deeper exploration, generate one or more self-contained follow-up queries. Each query must + include enough context so that a web search could answer it, For each query, give a short note explaining why you + use the query and what you hope it will reveal.', '- Focus on technical details, implementation specifics, and any + emerging methods or references that were overlooked.', '- Use clear, direct language and avoid unnecessary jargon.'] + agent.ResearcherAgent.search_agent: + type: class + models: [searcher] + tools: [WebSearchTool] + params: + class: ResearcherAgent + name: Search Agent + instructions: ['You are a research assistant. Given a search term, you search the web for that term and produce a concise + summary of the results. The summary must be 2-3 paragraphs and less than 300 words. Capture the main points. Write + succinctly, no need to have complete sentences or good grammar. This will be consumed by someone synthesizing a + report for a new idea, so its vital you capture the essence and ignore any fluff. Do not include any additional + commentary other than the summary itself.'] + agent.ResearcherAgent.writer_agent: + type: class + models: [writer] + params: + class: ResearcherAgent + name: Writing Agent + output_type: ReportData + instructions: ['You are a senior researcher responsible for proposing new ideas to address a defined research problem. + You will receive:', '- The research problem, including its evaluation metric and available data', '- A starting + research idea, possibly with its evolution history', '- Inspirations from earlier attempts', '- A list of related + online search results', '- A research progress score (0-100%) indicating how far the idea has advanced', 'Your goal + is to identify future research directions that address the target problem, using the starting point, prior attempts, + and related works. You should analyze existing methods, identify connections, and propose practical algorithms that + can be implemented with the available data.', 'Follow this structure to think and write:', 1. **Extract insights**, + 'Identify 3-5 scientific insights from the starting point and 3-5 from related works. For each insight, explain in + 2-3 sentences how it relates to the target problem.', 2. **Organize research directions**, 'Group the insights into + 3-5 coherent directions (for example, learning objectives, model classes, or optimization methods).', 3. **Build + a structured framework**, 'Create a conceptual map (such as a taxonomy, grid, or matrix) that unifies existing methods, + reveals patterns, and highlights gaps.', 4. **Generate and evaluate ideas**, '- First, propose 3-10 algorithmic + ideas of varying originality and complexity. Each idea should be:', '- As simple, minimal, and atomic as possible + but not trivial', '- Include brief pseudocode or logical steps where helpful.', '- Include references to the related + works.', '- For each idea, critically assess as a senior researcher with one positive and one negative reason:', + '- Originality (0-10): Is the idea new? Is the idea a novel combination of well-known techniques? Is it clearly different + from previous contributions?', '- Future Potential (0-10): Will others build on these ideas? Does this idea solve + a hard problem more effectively than prior work? Does it point to a new research direction?', '- Code Difficulty + (0-10): How complex is the implementation? How much code is required? How much time is required to implement?', + '- Then, select the single best idea from that list for detailed reporting, based on the research progress score:', + '- If progress is relatively early, prioritize feasible, easy-to-implement ideas with long-term promise.', '- If progress + is relatively mature, prioritize seminal ideas with high-impacts for the next-generation research', '- Otherwise, + balance ambition and implementation feasibility', 5. **Write the report in Markdown**, 'For the selected idea, include:', + '- A synthesis of insights and proposed directions', '- The structured framework of existing methods and the new algorithm', + '- A list of new ideas with their assessment scores', '- Detailed description of the chosen/best idea, including rationale, + pseudocode, and implementation notes', 'The report must be focused, technically accurate. Being concise with 200-500 + words without trivial and redundant information.', 'Support all claims with evidence and references, and remain + tightly aligned with the target problem.'] + +models: + debugger: + type: variable + agents: [agent.CoderAgent.debugger] + developer: + type: variable + agents: [agent.CoderAgent.developer] + planner: + type: variable + agents: [agent.ResearcherAgent.planner_agent, agent.ResearcherAgent.reflection_agent] + searcher: + type: variable + agents: [agent.ResearcherAgent.search_agent, agent.ResearcherAgent.reader_agent] + writer: + type: variable + agents: [agent.ResearcherAgent.writer_agent] + +tools: + WebSearchTool: + type: module + agents: [agent.ResearcherAgent.search_agent, agent.ResearcherAgent.reader_agent] + +imports: + Agent: agents.Agent + annotations: __future__.annotations + Any: typing.Any + apply_diff: utils.code.apply_diff + asyncio: asyncio + BaseModel: pydantic.BaseModel + CoderAgent: coder.CoderAgent + Console: rich.console.Console + custom_span: agents.tracing.custom_span + datetime: datetime.datetime + Dict: typing.Dict + DictConfig: omegaconf.DictConfig + Field: pydantic.Field + format_improvement_safe: utils.format.format_improvement_safe + format_metrics_safe: utils.format.format_metrics_safe + format_str: black.format_str + gen_trace_id: agents.tracing.gen_trace_id + get_files_and_code: utils.code.get_files_and_code + hydra: hydra + IdeaData: utils.datatypes.IdeaData + json: json + Levenshtein: rapidfuzz.distance.Levenshtein + List: typing.List + logging: logging + Mode: black.Mode + ModelSettings: agents.model_settings.ModelSettings + Optional: typing.Optional + os: os + parse_evolve_blocks: utils.code.parse_evolve_blocks + Path: pathlib.Path + Problem: problem.Problem + Program: database.Program + ProgramDatabase: database.ProgramDatabase + random: random + re: re + reasoning_models: utils.datatypes.reasoning_models + ReflectionPlan: utils.datatypes.ReflectionPlan + Repo: git.Repo + ReportData: utils.datatypes.ReportData + ResearcherAgent: researcher.ResearcherAgent + Runner: agents.Runner + save_code_to_files: utils.code.save_code_to_files + Set: typing.Set + shutil: shutil + time: time + trace: agents.tracing.trace + Tuple: typing.Tuple + Union: typing.Union + uuid: uuid + WebSearchItem: utils.datatypes.WebSearchItem + WebSearchPlan: utils.datatypes.WebSearchPlan + WebSearchTool: agents.WebSearchTool + +functions: + __init__: + type: sync + module: researcher + args: [self, planner, searcher, writer, reasoning_effort] + _calculate_feature_coords: + type: sync + module: database + args: [self, program] + params: + returns: List[int] + _calculate_island_diversity: + type: sync + module: database + args: [self, programs] + params: + returns: float + _enforce_population_limit: + type: sync + module: database + args: [self] + params: + returns: None + _feature_coords_to_key: + type: sync + module: database + args: [self, coords] + params: + returns: str + _is_better: + type: sync + module: database + args: [self, program1, program2] + params: + returns: bool + _log_iteration: + type: sync + module: deepevolve + args: [self, iteration, parent, child, elapsed_time] + params: + returns: None + _perform_searches: + type: async + module: researcher + args: [self, search_plan] + params: + returns: list[str] + _plan_searches: + type: async + module: researcher + args: [self, user_input] + params: + returns: WebSearchPlan + _reflection: + type: async + module: researcher + args: [self, user_input, last_input] + params: + returns: WebSearchPlan + _sample_exploitation_parent: + type: sync + module: database + args: [self] + params: + returns: Program + _sample_exploration_parent: + type: sync + module: database + args: [self] + params: + returns: Program + _sample_inspirations: + type: sync + module: database + args: [self, parent, n] + params: + returns: List[Program] + _sample_parent: + type: sync + module: database + args: [self] + params: + returns: Program + _sample_random_parent: + type: sync + module: database + args: [self] + params: + returns: Program + _save_best_program: + type: sync + module: deepevolve + args: [self, program] + params: + returns: None + _save_checkpoint: + type: sync + module: deepevolve + args: [self, iteration] + params: + returns: None + _save_program: + type: sync + module: database + args: [self, program, base_path] + params: + returns: None + _search: + type: async + module: researcher + args: [self, item, source_id] + _setup_logging: + type: sync + module: deepevolve + args: [self] + params: + returns: None + _update_archive: + type: sync + module: database + args: [self, program] + params: + returns: None + _update_best_program: + type: sync + module: database + args: [self, program] + params: + returns: None + _update_global_diversity: + type: sync + module: database + args: [self] + params: + returns: float + _write_report: + type: async + module: researcher + args: [self, user_input, search_results, last_input] + params: + returns: ReportData + add: + type: sync + module: database + args: [self, program, iteration, target_island] + params: + returns: str + apply_diff: + type: sync + module: utils.code + args: [original_code, diff_text] + params: + returns: str + debug: + type: async + module: coder + args: [self, input_code, error_message] + params: + returns: str + extract_diffs: + type: sync + module: utils.code + args: [diff_text] + params: + returns: List[Tuple] + format_improvement_safe: + type: sync + module: utils.format + args: [parent_metrics, child_metrics] + params: + returns: str + format_metrics_safe: + type: sync + module: utils.format + args: [metrics] + params: + returns: str + from_dict: + type: sync + module: database + args: [cls, data] + params: + returns: Program + get: + type: sync + module: database + args: [self, program_id] + params: + returns: Optional[Program] + get_best_program: + type: sync + module: database + args: [self, metric] + params: + returns: Optional[Program] + get_files_and_code: + type: sync + module: utils.code + args: [local_path, online_link, workspace_dir, code_extension] + params: + returns: Tuple + get_island_stats: + type: sync + module: database + args: [self] + params: + returns: List[dict] + get_top_programs: + type: sync + module: database + args: [self, n, metric] + params: + returns: List[Program] + increment_island_generation: + type: sync + module: database + args: [self, island_idx] + params: + returns: None + load: + type: sync + module: database + args: [self, path] + params: + returns: None + log_island_status: + type: sync + module: database + args: [self] + params: + returns: None + main: + type: sync + module: deepevolve + args: [config] + params: + returns: None + migrate_programs: + type: sync + module: database + args: [self] + params: + returns: None + next_island: + type: sync + module: database + args: [self] + params: + returns: int + parse_evolve_blocks: + type: sync + module: utils.code + args: [code] + params: + returns: List[Tuple] + read_paper: + type: async + module: researcher + args: [self, title, content, supplementary_info] + params: + returns: IdeaData + run: + type: async + module: researcher + args: [self, program, inspirations, trace_id, max_reflection_times, max_generations] + params: + returns: tuple + sample: + type: sync + module: database + args: [self] + params: + returns: Tuple + save: + type: sync + module: database + args: [self, path, iteration] + params: + returns: None + save_code_to_files: + type: sync + module: utils.code + args: [concatenated_code, output_dir] + params: + returns: Dict + set_current_island: + type: sync + module: database + args: [self, island_idx] + params: + returns: None + should_migrate: + type: sync + module: database + args: [self] + params: + returns: bool + to_dict: + type: sync + module: database + args: [self] + params: + returns: Dict + update_topic: + type: sync + module: researcher + args: [self, query, problem_name, problem_description, search_time_bias] + +variables: + OPENAI_API_KEY: + type: env + params: + caller: [os.environ] + +files: + best_dir: + type: variable + actions: [read] + params: + caller: [os.makedirs] + best_program_info.json: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [best_dir] + check_last_diff.py: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [self.workspace] + check_last_program.py: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [self.workspace] + check_no_change_input.py: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [self.workspace] + check_no_change_output.py: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [self.workspace] + checkpoint_dir: + type: variable + actions: [read] + params: + caller: [os.makedirs] + checkpoint_path: + type: variable + actions: [read] + params: + caller: [os.makedirs, self.database.save] + code_path: + type: variable + actions: [write] + params: + caller: [open] + alias: [f] + config.db_path: + type: variable + actions: [read] + params: + caller: [os.path.exists, self.load] + file_path: + type: variable + actions: [read, write] + params: + caller: [open, os.path.dirname, json.load] + alias: [f] + info.json: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [self.workspace] + info_path: + type: variable + actions: [write] + params: + caller: [open] + alias: [f] + initial_idea.json: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [self.workspace] + local_path: + type: variable + actions: [read] + params: + caller: [Path] + log_dir: + type: variable + actions: [read] + params: + caller: [os.makedirs] + metadata.json: + type: literal + actions: [read] + params: + caller: [os.path.join] + path: [save_path] + metadata_path: + type: variable + actions: [read] + params: + caller: [os.path.exists, open, json.load] + output_dir: + type: variable + actions: [read] + params: + caller: [os.makedirs] + path: + type: literal + actions: [read] + params: + caller: [Path(local_path), open, path.glob, os.path.exists] + program_path: + type: variable + actions: [read, write] + params: + caller: [open, json.load] + alias: [f] + programs_dir: + type: variable + actions: [read] + params: + caller: [os.path.exists, os.listdir, os.makedirs] + save_path: + type: variable + actions: [read] + params: + caller: [os.makedirs] + seed_dir: + type: variable + actions: [read] + params: + caller: [os.makedirs, Path] + temp_dir: + type: variable + actions: [read] + params: + caller: [os.makedirs, shutil.rmtree] + temp_repo_path: + type: variable + actions: [read] + params: + caller: [os.path.exists, shutil.rmtree, os.listdir]