Inter-Agent Communication
Overview
Basic Agent Communication
Using call_agent()
from health_universe_a2a import Agent, AgentContext
class OrchestratorAgent(Agent):
def get_agent_name(self) -> str:
return "Document Orchestrator"
def get_agent_description(self) -> str:
return "Coordinates document processing workflow"
async def process_message(self, message: str, context: AgentContext) -> str:
# Call with agent name (registry lookup)
analysis = await self.call_agent("document-analyzer", message, context)
# Call with local path (same pod)
summary = await self.call_agent("/summarizer", analysis, context)
# Call with direct URL
validation = await self.call_agent(
"https://external-service.com/validator",
summary,
context
)
return f"Workflow complete: {validation}"Using call_other_agent()
Agent Registry Configuration
Option 1: Environment Variable
Option 2: Configuration File
Multi-Agent Deployment
Advanced Communication Patterns
Sequential Processing
Parallel Processing
Error Handling and Fallbacks
Structured Data Communication
Best Practices
1. Design for Reliability
2. Use Appropriate Timeouts
3. Propagate Context Information
4. Monitor and Log Communication
Example: Complete Document Processing Workflow
Last updated
Was this helpful?