Swarms Chat Command Usage¶
The swarms chat command provides an interactive chat agent with optimized defaults for conversational interactions. The agent runs with max_loops="auto" for continuous interaction, similar to Claude Code.
Features¶
- Interactive Mode: Automatically enabled for continuous conversation
- Auto Loops: Runs with
max_loops="auto"for autonomous operation - Dynamic Context Window: Automatically adjusts context window (100,000 tokens)
- Dynamic Temperature: Adapts temperature based on conversation
- Optional Initial Task: Start with a task or begin with a prompt
Basic Usage¶
Start Chat Without Initial Task¶
The agent will prompt you for input when started.
Start Chat With Initial Task¶
The agent will process the initial task and then continue in interactive mode.
Advanced Usage¶
Custom Agent Name¶
Custom System Prompt¶
Full Customization¶
swarms chat \
--name "CodeReviewer" \
--description "An expert code reviewer specializing in Python" \
--system-prompt "You are a senior Python developer with expertise in code review and best practices" \
--task "Review my implementation of a binary search algorithm"
Using Python Module Directly¶
You can also run the chat command directly with Python:
How It Works¶
- The chat agent initializes with optimized settings:
interactive=True- Enables continuous interactionmax_loops="auto"- Autonomous loop executiondynamic_context_window=True- Adaptive context managementdynamic_temperature_enabled=True- Adaptive response generation-
context_length=100000- Large context window -
If you provide a
--task, the agent processes it first - After processing, the agent continues to prompt for input
- You can continue the conversation interactively
- Exit by typing 'exit', 'quit', or pressing Ctrl+C
Examples¶
Quick Question¶
Extended Conversation¶
Then continue with follow-up questions interactively.Code Review Session¶
swarms chat \
--name "CodeReviewer" \
--system-prompt "You are an expert code reviewer. Provide detailed feedback with suggestions." \
--task "I'll share some code for review"
Tips¶
- Use
--system-promptto customize the agent's behavior and expertise - Provide a
--taskto start with context before interactive mode - The agent remembers conversation history within the session
- All standard agent parameters are available for customization
Troubleshooting¶
If you encounter the error auto_chat_agent() got an unexpected keyword argument 'interactive', ensure you're using the latest version of Swarms where this has been fixed.