Solace Agent Mesh
raw JSON → 1.24.1 verified Sat May 09 auth: no python
Solace Agent Mesh is an open-source framework for building event-driven, multi-agent AI systems where specialized agents collaborate on complex tasks. Current version: 1.24.1. Released under Apache 2.0, with active development and frequent releases.
pip install solace-agent-mesh Common errors
error ImportError: cannot import name 'AgentMesh' from 'solace_agent_mesh' ↓
cause Outdated version of solace-agent-mesh (pre-1.0). The package structure changed.
fix
Upgrade to latest: pip install --upgrade solace-agent-mesh
error TypeError: agent() takes 1 positional argument but 2 were given ↓
cause Using positional arguments for decorator in v1.20+.
fix
Use keyword arguments: @mesh.agent(name='agent_name', description='...')
error ValueError: Missing required environment variable: SOLACE_HOST ↓
cause Environment variables not set or passed to AgentMesh constructor.
fix
Set SOLACE_HOST, SOLACE_VPN, SOLACE_USERNAME, SOLACE_PASSWORD environment variables or pass them to AgentMesh().
error RuntimeError: Event loop is closed ↓
cause Calling mesh.run() in an environment with an already closed event loop (e.g., Jupyter notebook).
fix
Use nest_asyncio.apply() or run in a separate script. For Jupyter: import nest_asyncio; nest_asyncio.apply()
Warnings
breaking In v1.20.0, the agent decorator signature changed from @mesh.agent(name, description) to @mesh.agent(name=..., description=...). Using positional arguments will raise a TypeError. ↓
fix Use keyword arguments: @mesh.agent(name='my_agent', description='...')
breaking In v1.22.0, the default event broker protocol changed from HTTP to MQTT. Existing configurations using HTTP must be updated. ↓
fix Set protocol='http' explicitly in AgentMesh constructor if you rely on HTTP.
gotcha The AgentMesh constructor requires SOLACE_HOST, SOLACE_VPN, SOLACE_USERNAME, SOLACE_PASSWORD environment variables. If any are missing, the mesh fails silently at startup. ↓
fix Set all environment variables or pass them explicitly as parameters.
deprecated The 'create_mesh' function is deprecated since v1.18.0 and will be removed in v2.0. Use AgentMesh constructor directly. ↓
fix Replace create_mesh(...) with AgentMesh(...).
gotcha Async agents must be defined with 'async def', but the @mesh.agent decorator does not enforce this; a sync function will cause runtime errors. ↓
fix Always define agent functions as async def agent_name(...).
Imports
- AgentMesh wrong
from solace_agent_mesh import AgentMesh; from solace_agent_mesh.core import AgentMeshcorrectfrom solace_agent_mesh import AgentMesh - create_agent wrong
from solace_agent_mesh import create_agentcorrectfrom solace_agent_mesh.agents import create_agent
Quickstart
from solace_agent_mesh import AgentMesh
# Initialize the mesh with Solace event broker credentials
mesh = AgentMesh(
solace_host=os.environ.get('SOLACE_HOST', ''),
solace_vpn=os.environ.get('SOLACE_VPN', ''),
solace_username=os.environ.get('SOLACE_USERNAME', ''),
solace_password=os.environ.get('SOLACE_PASSWORD', '')
)
# Define a simple agent
@mesh.agent(name="echo_agent", description="Repeats messages back")
async def echo_agent(message: str) -> str:
return f"Echo: {message}"
# Start the mesh
mesh.run()