Skip to content

Latest commit

 

History

History
128 lines (97 loc) · 3.35 KB

examples.md

File metadata and controls

128 lines (97 loc) · 3.35 KB

Examples

The framework includes several example applications demonstrating different features and use cases.

Basic Examples

REPL (example)

Simple interactive chat interface showing basic agent usage.

Calculator (example)

Math agent with tool usage and switching.

Context Variables (example)

Demonstrates passing execution-specific context to tools and agents.

Chat Applications

Basic Chat (example)

Examples demonstrating how to use LiteSwarm's stateful components:

  • lite_chat: Using the stateful chat interface built on top of Swarm
  • lite_team_chat: Using the stateful chat interface built on top of SwarmTeam

Client-Server Chat (example)

Example of building a client-server chat application:

  • Server: FastAPI server demonstrating:

    • User and session management
    • Streaming API endpoints
    • State handling
    • Multi-user support
  • Client: CLI client showing how to:

    • Handle real-time event streaming
    • Manage user sessions
    • Handle server connections

Team Examples

SwarmTeam Basic (example)

Introduction to SwarmTeam features:

  • Task definition and planning
  • Team member specialization
  • Plan execution and feedback

Mobile App Team (example)

Complex team of agents (PM, Designer, Engineer, QA) building a Flutter app:

  • Agent routing and switching
  • Specialized task handling
  • Team collaboration

Software Team (example)

Complete example demonstrating SwarmTeam's capabilities:

  • Advanced planning and task execution
  • Code generation and review
  • Project management

Advanced Examples

Parallel Research (example)

Parallel tool execution for efficient data gathering:

  • Concurrent API calls
  • Result aggregation
  • Error handling

Structured Outputs

  1. Core (example)

    • Basic structured outputs with Pydantic
    • Streaming and parsing
    • Type safety
  2. Chat (example)

    • Structured outputs in chat context
    • Stateful parsing
    • Chat-specific features
  3. Playground (example)

    • Different parsing strategies
    • Provider compatibility
    • Complex output handling

Running Examples

Basic examples:

# Try the REPL
make run-repl-example

# Run the calculator
make run-calculator-example

# Test context variables
make run-context-variables-example

Chat applications:

# Basic chat examples
make run-chat-lite-chat-example
make run-chat-lite-team-chat-example

# Client-server chat examples
make run-chat-api-server-example
make run-chat-api-client-example

Team examples:

# Basic team features
make run-swarm-team-basic-example

# Complex team examples
make run-mobile-app-example
make run-software-team-example

Advanced examples:

# Parallel execution
make run-parallel-research-example

# Structured outputs
make run-structured-outputs-core-example
make run-structured-outputs-chat-example
make run-structured-outputs-playground-example

For more details about specific features, see Advanced Features.