Building Your First Swarm
A single agent is great for simple Q&A. A Swarm is necessary for multi-step, complex workflows where different skills are required.
What is a Swarm?
A swarm typically consists of:
- Router Agent: The boss. Decides what needs to be done.
- Worker Agents: The specialists. (e.g., "Python Coder", "Copywriter").
- Reviewer Agent: The QA. Checks the work before showing the user.
Example: The Content Creator Swarm
Let's build a swarm that researches a topic and writes a blog post.
Step 1: Create the Researcher
Create a new bot. Give it the "Web Search" tool. Prompt it:
"You are a researcher. Given a topic, find the 3 most recent articles and summarize the key facts."
Step 2: Create the Writer
Create a second bot. Prompt it:
"You are a copywriter. Take the facts provided by the researcher and write a 500-word blog post in a casual tone."
Step 3: Link them in HiveLang
In your orchestration script, link them:
rubyagent ContentSwarm { trigger: "new_topic" actions: [ call Researcher with { topic: input.topic } => facts call Writer with { facts: facts } => draft return draft ] }
Now your swarm will independently research and write!
Use the test pane to iterate quickly. Every change you make is live — no need to save first.
API keys are shown only once. Store them securely and never commit them to version control.
Test your bot with edge cases before deployment. Try empty inputs, long messages, and special characters.
Chain multiple specialized bots in a workflow for better results than one general-purpose bot.