Agents
Agents are the fundamental building blocks of Solace Agent Mesh. They are autonomous AI-powered components that can process requests, use tools, maintain conversation history, and collaborate with other agents through the A2A (Agent-to-Agent) protocol.Agent Architecture
Each agent in Solace Agent Mesh is built on Google’s Agent Development Kit (ADK) and extended with mesh-specific capabilities:Key Components
Agent Component
The core orchestration layer that handles A2A messaging, task execution, and lifecycle management
ADK Agent
The underlying LLM-powered agent from Google ADK with access to tools and memory
Session Service
Manages conversation history and context across multiple interactions
Artifact Service
Handles file storage and retrieval for agent inputs/outputs
Agent Configuration
Basic Agent Setup
Create an agent by defining a YAML configuration file:agent_config.yaml
Advanced Configuration
Auto-Summarization
Auto-Summarization
Enable automatic conversation history summarization to handle long-running conversations:How it works:
- Monitors token count during execution
- Triggers progressive summarization when context limit approached
- Preserves recent messages while compressing older history
- Stores summaries in session database for continuity
src/solace_agent_mesh/agent/adk/runner.py:176-219:Agent Card Publishing
Agent Card Publishing
Configure how your agent advertises its capabilities:
Tool Scoping
Tool Scoping
Control which tools are available based on request metadata:Only requests with matching scopes in their A2A user config can use these tools.
Agent Execution Flow
When an agent receives a request through A2A:Task Execution Context
Each agent request creates a task execution context that tracks:- Task ID: Unique identifier for correlation
- Session ID: Links to conversation history
- User Identity: For access control and personalization
- A2A Context: Metadata, parent tasks, client info
- Active Tools: Currently executing tool calls
- Streaming State: Buffer for incremental responses
Agent-to-Agent Communication
Agents can invoke other agents using the A2A protocol:Hierarchical Task Tracking
Agents maintain parent-child relationships for delegated tasks:- Root tasks: Initiated by gateways/users
- Subtasks: Created when agents call other agents
- Task depth limits: Prevent infinite recursion
- Cancellation propagation: Parent cancels all children
Session Management
Agents use persistent sessions to maintain conversation context:Session Lifecycle
- Creation: First message creates new session
- Event Append: Each interaction adds events to session
- Compaction: Older events summarized when context grows
- Retrieval: Full history loaded on each request
Session Filtering
TheFilteringSessionService automatically handles:
- Ghost event removal: Events replaced by summaries are hidden
- Compaction tracking: Uses state_delta for O(1) filtering
- Progressive summaries: Newer summaries override older ones
src/solace_agent_mesh/agent/adk/runner.py:324-575:
Artifact Handling
Agents can create and reference artifacts (files/documents):Creating Artifacts
Referencing Artifacts in Responses
Use embed syntax to reference artifacts:Tool Integration
Agents can use tools via MCP (Model Context Protocol):MCP Tool Configuration
Tool Call Flow
Fromsrc/solace_agent_mesh/agent/adk/runner.py:1344-1450:
Error Handling
Agents handle various failure scenarios:Context Limit Errors
Automatic progressive summarization retries with compaction
LLM Call Limits
Configurable max calls per session with graceful termination
Tool Failures
Retry logic and error message formatting for LLM recovery
Task Cancellation
Clean cancellation with propagation to subtasks and tools
Best Practices
Instruction Design
Instruction Design
- Be specific about agent capabilities and limitations
- Include examples of expected input/output formats
- Define clear boundaries for tool usage
- Set appropriate tone and personality
Session Management
Session Management
- Use meaningful session IDs (e.g., user_id + conversation_id)
- Enable auto-summarization for long-running conversations
- Consider session cleanup policies for inactive users
Performance Optimization
Performance Optimization
- Configure appropriate model parameters (temperature, max_tokens)
- Use streaming for better user experience
- Implement tool result caching where applicable
- Monitor token usage and adjust compaction thresholds
Security
Security
- Use tool scoping to restrict sensitive operations
- Validate user permissions before processing requests
- Sanitize user inputs in tool calls
- Log security-relevant events for auditing
Next Steps
Gateways
Learn how gateways connect agents to external systems
A2A Protocol
Dive deep into the Agent-to-Agent messaging protocol
Workflows
Orchestrate multiple agents with prescriptive workflows
Orchestrator
Understand centralized agent coordination