diff --git a/agents/README.md b/agents/README.md index ce3645b..d8f3520 100644 --- a/agents/README.md +++ b/agents/README.md @@ -41,10 +41,10 @@ GH_TOKEN=github-token-with-repo-scope ### Local Execution -Run the agent for a specific conference: +Run the agent for a specific conference (using conference ID from the YAML file): ```bash -uv run --env-file keys.env -m agents.agent --conference_name dtech +uv run --env-file keys.env -m agents.agent --conference_name dtech26 ``` The agent will: @@ -56,12 +56,14 @@ The agent will: ### Environment Variables -- `ANTHROPIC_API_KEY` - Claude API key (required) +- `ANTHROPIC_API_KEY` - Claude API key (required, unless using Claude Code auth subscription) - `EXA_API_KEY` - Exa search API key (optional, for enhanced web search) - `GH_TOKEN` - GitHub token (required for PR creation) - `DISABLE_EXA_MCP` - Set to "1" to use built-in WebSearch instead of Exa MCP - `USE_MONOLITHIC_AGENT` - Set to "1" to use legacy monolithic agent (for debugging) +**Note**: If you're logged into Claude Code via auth, you can remove `ANTHROPIC_API_KEY` from `keys.env` to use your Claude subscription instead of API consumption. + ### Output The agent creates a pull request targeting the `ui-redesign` branch with: diff --git a/agents/orchestrator.py b/agents/orchestrator.py index 84c7861..41f17f1 100644 --- a/agents/orchestrator.py +++ b/agents/orchestrator.py @@ -217,7 +217,12 @@ async def orchestrate_conference_update( # Stage 4: Update YAML file print("[Stage 4] Generating YAML update...") - yaml_file_path = self.project_root / "src" / "data" / "conferences" / f"{conference_name}.yml" + + # Strip year suffix from conference_name to get base filename + # e.g., "windeurope26" -> "windeurope", "dtech27" -> "dtech" + import re + base_name = re.sub(r'\d{2}$', '', conference_name) + yaml_file_path = self.project_root / "src" / "data" / "conferences" / f"{base_name}.yml" # Determine if we should append (new year) or update (existing year) current_year = approved_data.get("year", 2026) # TODO: parameterize year diff --git a/agents/skills/yaml_skill.py b/agents/skills/yaml_skill.py index 1ef2441..747dc9f 100644 --- a/agents/skills/yaml_skill.py +++ b/agents/skills/yaml_skill.py @@ -188,6 +188,7 @@ async def execute( # Query the agent try: output_text = "" + tool_usage_detected = False async for message in agent_query_fn(user_prompt, prompt): # Process message to extract JSON response @@ -196,6 +197,9 @@ async def execute( for block in message.content: if TextBlock and isinstance(block, TextBlock): output_text += block.text + # Check if tools were used (ToolUseBlock or ToolResultBlock) + if hasattr(block, '__class__') and 'Tool' in block.__class__.__name__: + tool_usage_detected = True elif hasattr(message, "content"): # Fallback for when SDK types not available for block in message.content: @@ -203,9 +207,42 @@ async def execute( output_text += block.text elif isinstance(block, str): output_text += block + # Check for tool usage + if hasattr(block, '__class__') and 'Tool' in str(block.__class__.__name__): + tool_usage_detected = True - # Parse the JSON response - result = self._parse_yaml_output(output_text) + # If tools were used, read the file to get final state + if tool_usage_detected: + try: + yaml_path = Path(input_data["existing_yaml_path"]) + updated_content = yaml_path.read_text(encoding="utf-8") + + # Check if file changed + if updated_content != existing_content: + # File was updated - extract summary from agent's text + result = { + "status": "success", + "updated_yaml": updated_content, + "changes_summary": "File updated using tools", + "changed_fields": input_with_context.get("extracted_fields", []) + } + else: + result = { + "status": "no_changes", + "updated_yaml": None, + "changes_summary": "No changes needed", + "changed_fields": [] + } + except Exception as e: + result = { + "status": "error", + "updated_yaml": None, + "changes_summary": f"Failed to read updated file: {e}", + "changed_fields": [], + } + else: + # No tools used - try to parse JSON response + result = self._parse_yaml_output(output_text) # Validate output is_valid, error_msg = await self.validate_output(result) diff --git a/src/data/conferences/smart_grids_canada.yml b/src/data/conferences/smart_grids_canada.yml index 1bb842d..7495ff4 100644 --- a/src/data/conferences/smart_grids_canada.yml +++ b/src/data/conferences/smart_grids_canada.yml @@ -25,8 +25,7 @@ - power-systems - energy-transition - renewable-energy - # Extracted on 2026-01-15 using Exa MCP from https://www.canada.smart-grids-conference.com/ - description: Smart Grids Canada 2026 is the premier forum for power infrastructure and smart grid technologies in Canada. The conference focuses on modernising the electricity grid with cutting-edge smart grid technologies, addressing challenges in the ageing power grid, and integrating Distributed Energy Resources (DER) and the associated reliability, safety, and control challenges. The event highlights innovations in delivering electricity and advancing essential infrastructure. + description: "Smart Grids Canada 2026 is the premier forum for power infrastructure and smart grid technologies in Canada. The conference focuses on modernising the electricity grid with cutting-edge smart grid technologies, addressing challenges in the ageing power grid, and integrating Distributed Energy Resources (DER) and the associated reliability, safety, and control challenges." topics: - Market Fundamentals in Evolving Power Systems and Grid Infrastructure - Economics of Grid Control, Distribution, and Large-Scale Power System Planning and Operations @@ -39,4 +38,14 @@ - Navigating Energy Policies and Industry Standards for Grid Transformation, Compliance, Innovation, and Modernization - Smart Grid Infrastructure - Distributed Energy Resource Integration - note: 'Premier forum for power infrastructure and smart grid technologies. Focus on modernizing the electricity grid with cutting-edge smart grid technologies, DER integration, AI and data analytics, and grid reliability' + note: "2nd Annual event. Premier forum for power infrastructure and smart grid technologies. 100+ industry topics, 8 networking events. No specific submission deadlines found on website." + sponsors: + - New Math Data + - Mathworks + - Southwire + - Celanese + - ELEKS + - Integral Analytics + metrics: + speakers: 50 + sessions: 20