feat(models): introduce native models for OpenAgents with A2A compati…#233
feat(models): introduce native models for OpenAgents with A2A compati…#233
Conversation
…bility - Added native models: Skill, Artifact, Task, and AgentProfile, extending A2A protocol models. - Implemented bidirectional conversion functions between native and A2A models. - Enhanced task delegation mod with A2A compatibility, including delegation lifecycle events and capability matching utilities. - Updated tests for native models and capability routing to ensure functionality and compatibility.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This pull request introduces native models for OpenAgents with A2A protocol compatibility, representing a significant architectural enhancement:
Purpose: Add native OpenAgents models (Skill, Artifact, Task, AgentProfile) that extend A2A protocol models while maintaining backward compatibility, and enhance task delegation with capability-based routing.
Key Changes:
- Native model implementations with bidirectional A2A conversion
- Enhanced task delegation mod with A2A compatibility and capability-based routing
- External delegator for cross-network A2A task delegation
- Capability matcher utilities for structured and LLM-based agent matching
- Discovery mod enhancements for skill announcement
Reviewed changes
Copilot reviewed 39 out of 40 changed files in this pull request and generated 25 comments.
Show a summary per file
| File | Description |
|---|---|
src/openagents/models/*.py |
New native models: Skill, Artifact, Task, AgentProfile with A2A conversion |
src/openagents/utils/native_converters.py |
Bidirectional converters between native and A2A models |
src/openagents/mods/coordination/task_delegation/mod.py |
Major refactor to use A2A Task model with delegation metadata |
src/openagents/mods/coordination/task_delegation/a2a_delegation.py |
A2A delegation utilities and metadata helpers |
src/openagents/mods/coordination/task_delegation/capability_matcher.py |
Capability-based agent matching with structured and LLM support |
src/openagents/mods/coordination/task_delegation/external_delegator.py |
External A2A agent delegation handler |
src/openagents/mods/coordination/task_delegation/adapter.py |
Enhanced adapter with routing, accept/reject, and cancel operations |
src/openagents/mods/discovery/agent_discovery/adapter.py |
New announce_skills tool for capability broadcasting |
src/openagents/mods/discovery/agent_discovery/mod.py |
Configurable connection/disconnection broadcasting |
tests/models/test_native_models.py |
Comprehensive tests for native models and conversions |
tests/mods/test_capability_routing.py |
Tests for capability matching and routing |
src/openagents/core/transports/a2a.py |
A2A transport delegation methods |
src/openagents/utils/mod_loaders.py |
Support for mod config dictionaries |
src/openagents/utils/agent_loader.py |
Enhanced mod configuration processing |
studio/src/components/editors/LazyMonacoEditor.tsx |
Lazy-loaded Monaco editor for performance |
studio/craco.config.js |
Code splitting configuration |
| Various UI files | Monaco editor lazy loading and UI improvements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| task = Task(**task_data) | ||
|
|
||
| # Store in TaskStore | ||
| asyncio.create_task(self.task_store.create_task(task)) |
There was a problem hiding this comment.
The asyncio.create_task call on line 264 is used for loading tasks at initialization, but there's no mechanism to await or track this task. If the application shuts down before this task completes, tasks may not be loaded. Consider awaiting this operation during initialization or adding it to a tracked task list.
| } | ||
|
|
||
| def shutdown(self) -> bool: | ||
| async def shutdown(self) -> bool: |
There was a problem hiding this comment.
The shutdown method signature changed from synchronous to asynchronous, but this is a breaking change. The base class BaseMod likely has a synchronous shutdown method, and this override makes it async without updating the base class contract.
| # Cleanup - use sync shutdown for tests | ||
| import asyncio | ||
| try: | ||
| loop = asyncio.get_running_loop() |
There was a problem hiding this comment.
Variable loop is not used.
| {"id": "minimal", "name": "Minimal Skill"}, | ||
| ] | ||
|
|
||
| result = await discovery_adapter.announce_skills(skills) |
There was a problem hiding this comment.
Variable result is not used.
| import sys | ||
|
|
||
| # Temporarily remove a2a module to simulate no A2A | ||
| a2a_modules = [k for k in sys.modules.keys() if "a2a" in k.lower()] |
There was a problem hiding this comment.
Variable a2a_modules is not used.
| from openagents.models.a2a import ( | ||
| AgentSkill, | ||
| Artifact as A2AArtifact, | ||
| Task as A2ATask, | ||
| TaskState as A2ATaskState, | ||
| TaskStatus, | ||
| TextPart, | ||
| AgentCard, | ||
| AgentCapabilities, | ||
| ) |
There was a problem hiding this comment.
Import of 'AgentCapabilities' is not used.
| import asyncio | ||
| import aiohttp | ||
| from bs4 import BeautifulSoup | ||
| from typing import Dict, Any |
There was a problem hiding this comment.
Import of 'Any' is not used.
Import of 'Dict' is not used.
| from typing import Dict, Any |
| Web search tool using DuckDuckGo (no API key required) | ||
| """ | ||
| import asyncio | ||
| from typing import Dict, Any |
There was a problem hiding this comment.
Import of 'Any' is not used.
Import of 'Dict' is not used.
| from typing import Dict, Any |
| self._polling_tasks[local_task_id].cancel() | ||
| try: | ||
| await self._polling_tasks[local_task_id] | ||
| except asyncio.CancelledError: |
There was a problem hiding this comment.
'except' clause does nothing but pass and there is no explanatory comment.
| except asyncio.CancelledError: | |
| except asyncio.CancelledError: | |
| # Cancellation is expected when stopping the background polling task. |
| try: | ||
| await self._timeout_task | ||
| except asyncio.CancelledError: | ||
| pass |
There was a problem hiding this comment.
'except' clause does nothing but pass and there is no explanatory comment.
| pass | |
| logger.debug("Timeout checker task cancelled during shutdown") |
- Removed the SYSTEM_EVENT_REPORT_LLM_LOG event and associated handling from the system commands. - Updated EventBasedLLMLogger to log LLM calls locally instead of sending them to the network. - Cleaned up related code and documentation to reflect the change in logging strategy.
…rkflow - Introduced a new demo showcasing a coordinated multi-agent workflow for finding and comparing alternative web services. - Added `network.yaml` for network configuration and project template. - Created `README.md` detailing architecture, workflow, and usage instructions. - Implemented `coordinator.py`, `searcher.yaml`, and `comparer.yaml` for agent functionalities. - Developed tools for web searching and webpage fetching to support agent operations. - Included a test script `test_workflow.py` to validate the end-to-end workflow.
- Enhanced `network_readme.yaml` and `network.yaml` with improved formatting and additional fields for clarity. - Added `initialized` and `created_by_version` attributes to both network configurations. - Updated README content in `network_readme.yaml` for better documentation of features and usage. - Adjusted agent group configurations and transport settings for consistency across test networks. - Modified `agent_loader.py` to auto-include messaging mod for WorkerAgent, improving mod management. - Updated tests to reflect changes in tool availability and task delegation constants.
- Simplified the logic for identifying WorkerAgent subclasses by consolidating checks for class type, class name, and string representation. - Improved handling of mock classes in tests to ensure accurate detection of WorkerAgent instances. - Enhanced code readability and maintainability by reducing nested try-except blocks.
…tatus handling - Introduced new task status constants to reflect the updated task lifecycle, with tasks starting as "submitted" instead of "in_progress". - Refactored test cases to utilize the new A2A Task model, ensuring accurate task state verification and metadata handling. - Enhanced task creation and state retrieval methods to align with the updated task structure and asynchronous shutdown processes. - Updated assertions in tests to validate task delegation, progress reporting, and completion handling with the new model.
…bility