Skip to main content

What This Example Shows

  • Creating a single agent with specific expertise
  • Configuring agent parameters (model, temperature, tokens)
  • Running agents with structured tasks
  • Handling agent responses and outputs
Single agents are the building blocks of the Swarms API. Each agent can be configured with specific models, temperatures, and expertise areas.

Quick Start

Agent Configuration Explained

  • agent_name: A descriptive name for your agent
  • description: What the agent does
  • system_prompt: The agent’s expertise and behavior instructions
  • model_name: The AI model to use (supports OpenAI, Anthropic, Groq, and more)
  • max_loops: Maximum reasoning iterations (1 for single-pass tasks)
  • max_tokens: Maximum response length
  • temperature: Creativity level (0.0 = focused, 1.0 = creative)

Expected Output

The agent will provide a structured medical analysis including:
  • Interpretation of each blood value
  • Possible diagnoses based on the results
  • Recommended next steps for the patient
  • Clinical context and significance

Environment Setup

Create a .env file in your project directory:

Customization Ideas

You can adapt this pattern for:
  • Legal Analysis: Contract review agents
  • Code Review: Software quality assurance agents
  • Content Creation: Writing and editing agents
  • Data Analysis: Business intelligence agents
  • Customer Support: FAQ and troubleshooting agents

Next Steps

After mastering single agents, explore:
  • Multi-agent swarms for complex workflows
  • Batch processing for multiple tasks
  • Agent chaining for sequential reasoning