swarms icon indicating copy to clipboard operation
swarms copied to clipboard

feat: add swarm output schemas and agent fixes

Open Occupying-Mars opened this issue 1 month ago • 0 comments

Unified Swarm Output Schema

for harshals ui

Changes Made

  1. Created a new unified schema system in swarms/schemas/swarm_output_schemas.py that standardizes output across all swarm types:

    • Base SwarmOutput schema for common fields
    • Specialized schemas for each swarm type (MixtureOfAgents, SpreadsheetSwarm, AgentRearrange, etc.)
    • Each schema includes type-safe Pydantic models with proper field validation
  2. Added specialized output classes for different swarm types:

    • AgentRearrangeOutput: For agent rearrangement workflows
    • ConcurrentWorkflowOutput: For parallel execution stats
    • SequentialWorkflowOutput: For workflow chain tracking
    • AutoSwarmOutput: For auto-selected strategy details
    • MixtureOfAgentsOutput: For aggregated agent summaries
    • SpreadsheetSwarmOutput: For CSV data handling
  3. Enhanced the Agent class with a unified create_swarm_output method that:

    • Creates standardized output for all swarm types
    • Handles metadata appropriately for each type
    • Provides consistent formatting

Benefits

  • Consistent output structure across all swarm types
  • Type safety through Pydantic models
  • Simplified UI parsing with built-in formatting methods
  • Easier maintenance and extensibility
  • Reduced code duplication
  • Better error handling and validation

Breaking Changes

None. This is a new feature that enhances existing functionality without breaking existing implementations.


📚 Documentation preview 📚: https://swarms--742.org.readthedocs.build/en/742/

Occupying-Mars avatar Jan 10 '25 17:01 Occupying-Mars