Files
hermes-agent/agent/evolution/skill_synthesizer.py
Google AI Agent 23bda95e1c
All checks were successful
Supply Chain Audit / Scan PR for supply chain risks (pull_request) Successful in 11s
feat: implement Phase 6 - Skill Synthesizer
2026-03-30 23:01:22 +00:00

47 lines
1.3 KiB
Python

"""Phase 6: Automated Skill Synthesis.
Analyzes research notes to automatically generate and test new Python skills.
"""
import logging
import json
from typing import List, Dict, Any
from agent.gemini_adapter import GeminiAdapter
from tools.gitea_client import GiteaClient
logger = logging.getLogger(__name__)
class SkillSynthesizer:
def __init__(self):
self.adapter = GeminiAdapter()
self.gitea = GiteaClient()
def synthesize_skill(self, research_notes: str) -> Dict[str, Any]:
"""Analyzes research notes and generates a new skill."""
prompt = f"""
Research Notes:
{research_notes}
Based on these notes, identify a potential new Python skill for the Hermes Agent.
Generate the Python code for the skill, including the skill metadata (title, description, conditions).
Format the output as JSON:
{{
"skill_name": "...",
"title": "...",
"description": "...",
"code": "...",
"test_cases": "..."
}}
"""
result = self.adapter.generate(
model="gemini-3.1-pro-preview",
prompt=prompt,
system_instruction="You are Timmy's Skill Synthesizer. Your goal is to turn research into functional code.",
response_mime_type="application/json",
thinking=True
)
skill_data = json.loads(result["text"])
return skill_data