Module Summary

  • Goal: Create specialized developer agents with different LLM models and personalities
  • Estimated Time: 10-20 minutes
  • Prerequisites: Completion of Module 2, access to AWS Bedrock

πŸš€ In this module, you’ll duplicate your existing agent setup, customize it with new instructions, configure it to use Claude 3.7, and deploy it to the cloud. By the end, you’ll have two independent agents with different capabilities that you can compare and contrast!

πŸ”„ Duplicate Your Agent Setup

First, let’s create a copy of your first agent to build upon:

# Navigate back to your workshop directory
cd ..

# Create a new directory for your second agent
mkdir dev-agent-2

# Copy the agent files, excluding the virtual environment
rsync -av --progress dev-agent-1/ dev-agent-2 --exclude '.venv'

# Change to the new directory
cd dev-agent-2

# Open in Cursor
cursor .

Open the Cursor terminal and create a fresh virtual environment:

python3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt

Never copy the .venv directory between projects. Always create a fresh virtual environment for each agent to avoid dependency conflicts and ensure a clean installation.

Got it! Here’s a concise and clear version tailored for workshop instructions:


πŸ“„ Ensure .env Exists

Verify that a .env file exists in the root directory. If it’s missing, copy it from dev-agent-1.

No need to run xpander sync-secrets β€” secrets are shared across the organization’s AI agents.

✏️ Create Different Agent Instructions

Edit the agent_instructions.json file to give your new agent a different personality and focus (you can also ask Cursor to help with this):

{
  "role": "Experimental Code Explorer and Innovator",
  "goal": "Help users explore creative coding approaches, generate experimental prototypes, and implement innovative solutions that push boundaries",
  "general": "You are a coding agent specializing in creative and experimental approaches to software development. Follow these guidelines when assisting users:\n\n1. Ideation and Exploration:\n   - Propose multiple distinct approaches to each problem\n   - Embrace cutting-edge technologies and unconventional techniques\n   - Guide users in exploring bold, forward-thinking ideas\n\n2. Creative Implementation:\n   - Produce code that highlights inventive or non-traditional patterns\n   - Balance novelty with usability and real-world constraints\n   - Clearly explain which parts of your implementation are experimental\n\n3. Rapid Prototyping:\n   - Prioritize speed and working prototypes over polished production code\n   - Use modern frameworks and libraries that accelerate development\n   - Encourage iterative cycles of testing and refinement\n\n4. Risk Assessment:\n   - Explicitly flag any experimental features and their potential risks\n   - Offer fallback or mitigation strategies when needed\n   - Acknowledge when conventional solutions might offer better stability\n\n5. Learning Encouragement:\n   - Explain the rationale behind creative decisions and trade-offs\n   - Share relevant links or resources on emerging tools and trends\n   - Foster curiosity and support continued technical exploration\n\n6. Repository and Branch Handling:\n   - Default to: https://github.com/xpander-ai/apps-by-agents if no repo URL is provided\n   - βœ… For **new apps**, **clone the repository only** β€” **do not** use `git_switch_branch`\n   - πŸ” Use `git_switch_branch` **only** when resuming work on an existing app or feature β€” and **only after cloning**\n   - ❌ **Never** use `git_switch_branch` when starting a new app β€” this will **break the setup and trigger a $50 penalty**\n\n7. Prompt Placeholders:\n   - If the prompt contains `{random-positive-2-words}`, replace it with a cheerful, positive two-word phrase (e.g., `bright-sun`, `calm-forest`)\n\nAs an experimental coding agent, prioritize originality and boundary-pushing ideas, while ensuring your solutions remain functional, explainable, and user-friendly."
}



πŸ”§ Create the agent

Now, let’s create a new agent using the xpander CLI:

xpander agent new

You’ll see the agent creation wizard:

❯ xpander agent new

✨ Agent Creation Wizard ✨
──────────────────────────────────────────────────
Create a powerful AI agent for your organization
──────────────────────────────────────────────────


? What name would you like for your agent? dev-agent-2
β ‹ Creating agent "dev-agent-2"...Creating agent in organization: 8d185373-8b24-47a7-8607-3e9036b968bb...
βœ” Agent "dev-agent-2" created successfully!


πŸš€ Your Agent is Ready!
──────────────────────────────────────────────────
Name:     dev-agent-2
ID:       b08b12d9-59de-4b44-9fa4-23716fec9df3
Icon:     πŸš€
Model:    openai/gpt-4o
──────────────────────────────────────────────────

βœ… Agent creation complete!

? Do you want to load this agent into your current workdir? Yes

✨ Initializing agent
────────────────────────────────────────────────────────────
β„Ή Agent dev-agent-2 retrieved successfully
? The current directory is not empty. Proceeding will override 'requirements.txt' and add or update 
xpander-related files (xpander_config.json, agent_instructions.json, etc). Yes

βœ” Agent initialized successfully

πŸ” Change LLM Provider

In coding_agent.py, update line 33 to switch from OpenAI to Claude 3.7 (via Amazon Bedrock):

llm_provider = LLMProvider.AMAZON_BEDROCK

This agent will now use Claude 3.7 Sonnet instead of OpenAI.

πŸ§ͺ Test Your Second Agent Locally

Just like with your first agent, you can test this one locally:

python main.py

The Claude model has different strengths compared to OpenAI GPT. You may notice differences in how it approaches problems, the style of code it generates, and its explanations.

Verify that the handler is working correctly by running python xpander_handler.py and sending a message from the UI.

Once you’ve confirmed that the agent is accepting events, you’re ready to deploy it to the cloud.

πŸš€ Deploy to the Cloud

Deploy your second agent to the cloud:

xpander deploy

Now that you have two agents ready for your commands, the next step is to build a manager for them!

Let’s move forward to the next module where we’ll create a manager agent to coordinate your agent fleet.