What you’ll build: A simple greeting agent that responds to user messagesTime: ~10 minutesPrerequisites:
- Python 3.10.16+
- Solace Agent Mesh installed (
pip install solace-agent-mesh) - An LLM API key (OpenAI, Anthropic, or any compatible provider)
What you’ll learn
In this tutorial, you’ll create your first AI agent and learn:- How to structure a basic agent configuration
- How to run your agent locally
- How to interact with your agent via the Web UI
- Basic agent configuration options
Step-by-step guide
Create a new project directory
First, create a dedicated directory for your agent mesh project:Create and activate a Python virtual environment:
Initialize the project
Use the SAM CLI to initialize a new project:This will open a web interface on port 5002. Follow these steps:
- Select broker type: Choose “Local” for development
- Configure LLM: Enter your API key and select your model
- Choose components: Select “Web UI Gateway” and “Orchestrator”
- Complete setup: Click “Initialize Project”
Create your first agent
Create a new file called
hello_agent.yaml in your project directory:hello_agent.yaml
The
shared_config.yaml file is created automatically by sam init and contains your broker connection details and LLM configuration.Understanding the configuration
Let’s break down the key parts of your agent configuration:Agent Identity
- agent_name: Unique identifier used for agent-to-agent communication
- display_name: Human-friendly name shown in the UI
- namespace: Isolates agents in different environments
Instructions
Session Service
- type: “memory”: Stores conversation history in memory (for development)
- default_behavior: “PERSISTENT”: Maintains conversation context across messages
type: "sql" with a database URL.
Agent Card
The agent card is like a business card - it tells other agents and the orchestrator what your agent can do:Next steps
Add weather capabilities
Build an agent that can fetch real-time weather data
Create a simple workflow
Learn how to orchestrate multiple agents
Connect to databases
Enable your agent to query SQL databases
Agent architecture
Understand how SAM agents work under the hood
Troubleshooting
Agent won't start - connection error
Agent won't start - connection error
Problem: Cannot connect to brokerSolution: Ensure your If using
.env file has the correct broker settings:sam init --gui, these are configured automatically.LLM API errors
LLM API errors
Problem: “Invalid API key” or “Model not found”Solution: Check your LLM configuration in Ensure your
shared_config.yaml:.env file has valid credentials.Web UI not loading
Web UI not loading
Problem: Cannot access http://localhost:8000Solution:
- Check that the Web UI gateway is running in your configuration
- Look for port conflicts in the logs
- Try accessing http://127.0.0.1:8000 instead
Agent not responding
Agent not responding
Problem: Messages sent but no responseSolution:
- Check the logs in
hello_agent.log - Verify the agent is properly registered (look for “HelloAgent started successfully”)
- Ensure
supports_streaming: trueis set if using the Web UI
Key concepts learned
- How to create and configure a basic agent
- Understanding agent identity and discovery
- Using the Web UI to interact with agents
- Basic troubleshooting techniques
