Instructions for developing data agents in the SWF (Scientific Workflow) framework, including naming patterns, messaging types, and logging utilities from example agents.
Instructions for developing data agents in the SWF (Scientific Workflow) framework.
This skill provides guidance on building data agents for the SWF framework, following established patterns from the swf-testbed example agents. Use these conventions for agent naming, message handling, and logging.
All agents must follow this naming convention:
```python
import getpass
username = getpass.getuser()
agent_id = self.get_next_agent_id()
self.agent_name = f"{self.agent_type.lower()}-agent-{username}-{agent_id}"
```
**Pattern:** `{agent_type}-agent-{username}-{agent_id}`
Example: `data-agent-jsmith-001`
The SWF framework uses these message types for workflow coordination:
1. **Reference Example Agents**
- Locate example agents in `../swf-testbed/example_agents/`
- Study the logging utilities used in these source files
- Follow the established patterns for consistency
2. **Logging**
- Use the logging utilities from example agents
- Maintain consistent log levels and formatting
- Include agent_name in log messages for traceability
3. **Message Handling**
- Implement handlers for all relevant message types
- Ensure proper state transitions between run phases
- Handle pause/resume logic if applicable
4. **Agent Initialization**
- Set `agent_type` appropriately for your agent's role
- Use the naming pattern for automatic agent_name generation
- Obtain unique agent_id through `get_next_agent_id()`
1. Review example agents in `../swf-testbed/example_agents/` to understand the framework
2. Import logging utilities from example agents
3. Implement agent_name generation using the standard pattern
4. Create message handlers for relevant message types
5. Test with SWF workflow coordinator
6. Verify logging output and message flow
```python
import getpass
class MyDataAgent:
def __init__(self):
self.agent_type = "data"
username = getpass.getuser()
agent_id = self.get_next_agent_id()
self.agent_name = f"{self.agent_type.lower()}-agent-{username}-{agent_id}"
self.setup_logging() # Use logging utilities from examples
def handle_message(self, msg_type, payload):
if msg_type == 'start_run':
# Handle run start
pass
elif msg_type == 'data_ready':
# Handle data availability
pass
# ... other message handlers
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/swf-data-agent-development/raw