Module 2: Build Your First Coding Agent
Set up a local developer agent and understand its core capabilities
Module Summary
- Goal: Create and deploy your first AI developer agent
- Estimated Time: 20-30 minutes
- Prerequisites: AWS credentials, Python 3.12+, Cursor IDE
π In this module, youβll set up a complete AI coding assistant powered by xpander.ai and Amazon Bedrock. Youβll create a local development environment, configure your agent with custom instructions, test it with repository management tasks, and connect it to the cloud for remote access. By the end, youβll have a powerful AI developer agent that can clone repositories, read and write code, and help automate your development workflow!
π§ Setup Your Development Environment
Letβs start by creating a workspace directory and cloning the base agent repository:
Open the project in Cursor IDE:
π οΈ Configure Your Local Environment
This workshop requires Python 3.12.7 or newer. To check your current version, run:
If you need to upgrade, use the following methods:
- macOS:
brew uninstall python --ignore-dependencies && \ brew install python3 && python3 --version
- Windows (WSL/Git Bash): Download the latest installer from python.org
Inside the Cursor terminal, set up your Python environment and install dependencies:
π Authenticate to xpander.ai
This command will open the xpander.ai platform and ask you to login or register. Once confirmed, you will be redirected back to the terminal, which will display something similar to:
Create a .env
file in the root directory with the following credentials:
Make sure you have your AWS credentials set up with Amazon Bedrock access and an xpander.ai API key ready for this step. If you are running this workshop in person, ask the xpander.ai team to provide you access.
π€ Create Your Agent
Now letβs use the xpander CLI to create a new agent:
Complete the agent creation wizard (Answer yes to load the agent locally):
If you skipped the init command, you can always run xpander agent init
and select the agent you just created.
π Run Your Agent Locally
Now itβs time to run your agent and ask it to introduce itself and its architecture!
Pay attention that the agent is limited to running inside the sandbox folder. To see files generated by the agent, navigate to the sandboxes
folder and look for the thread ID from the terminal output.
π¬ Example Agent Interaction
Hereβs what you might see in the terminal as your agent runs:
After completing various tasks (like creating a markdown introduction file), youβll see the final agent response:
You can now interact with your agent through the terminal by typing messages and questions!
Ask your agent follow-up questions about how function calling works and how it succeeded in performing the git clone operation. Also ask it to explain what the agent loop is.
π Stream Events from the Cloud to Your Local Agent
Now letβs set up your agent to receive events from the xpander.ai cloud platform. This allows you to interact with your agent through the web UI while processing happens on your local machine.
Start the event handler to listen for cloud events:
This url is the frontend of your agent, and itβs already configured with threads and memory. Try chatting and watch the events coming to your local machine.
You can also see the agent in the Tester Tab
- Navigate to the URL displayed in the terminal output (e.g.,
https://app.xpander.ai/agents/your-agent-id
) or to https://app.xpander.ai and search for dev-agent-1 - Youβll see your agent in the xpander.ai web interface
- Try sending a message like βHiβ to your agent
- Watch as the request is processed by your local machine and the response appears in the web UI
You can now send new messages in the Tester tab, and this time the agent will respond directly from your local machine!
Agent responding from local machine through cloud UI
Youβve built an agent capable of receiving events from anywhere (Slack, MCP, Teams, REST API, and even other Agents using A2A) with just a few lines of code! This allows you to focus your time on writing the business logic rather than integration code.
π Deploy to the Cloud
Now that weβve confirmed the agent is performing its job and can receive events from the cloud, we can simply host it as a container in the xpander cloud and trigger it when needed!
Deploy the agent to the cloud:
Example output:
Congratulations on deploying your agent to the cloud! While the deployment is in progress, letβs configure the necessary environment variables in the xpander vault to ensure your agent can run properly in the cloud environment.
π Configure Cloud Environment Variables
- Navigate to the xpander.ai platform and sign in
- Go to settings > Environment Secrets
- Add the following keys with their respective values:
Make sure to create a Personal Access Token (classic) with repository action permissions
These credentials will allow your cloud-deployed agent to access Amazon Bedrock services securely without storing sensitive information in your code.
Configuring these environment variables in the vault is crucial for cloud deployment. Your local .env file is not uploaded to the cloud for security reasons, so these values must be configured separately in the xpander platform.
Once deployment is complete and environment variables are configured, your agent will be fully operational in the cloud, allowing others to interact with it through the web interface.
Access your agent via the agent platform (https://app.xpander.ai/agents)
run xpander logs
to stream logs from the remote server to your terminal
β Checkpoint
By completing this module, you should now be able to:
- Create and configure a developer agent with xpander.ai
- Run the agent locally and interact with it via terminal
- Connect your local agent to the xpander.ai cloud platform
- Deploy your agent to the cloud for remote access
- Understand the core architecture of developer agents
π Next Steps
Now that youβve built your first developer agent, youβre ready to expand your agent fleet in the next module.