Petstore/Template Agent
- ๐ค Petstore Agent is an LLM-powered agent built using the LangGraph ReAct Agent workflow and Petstore MCP Server.
- ๐ Protocol Support: Compatible with A2A protocol for integration with external user clients.
- ๐ก๏ธ Secure by Design: Enforces API token-based RBAC and supports secondary external authentication for strong access control.
- ๐ญ MCP Server: The MCP server is generated by our first-party openapi-mcp-codegen utility, ensuring version/API compatibility and software supply chain integrity.
- ๐ MCP Tools: Uses langchain-mcp-adapters to glue the tools from Petstore MCP server to LangGraph ReAct Agent Graph.
- ๐งช Mock Server: Includes a built-in mock server for testing and development purposes.
๐๏ธ Architectureโ
Detailed Sequence Diagram with Agentgateway
System Diagramโ
Sequence Diagramโ
โ๏ธ Local Development Setupโ
Use this setup to test the agent against the Petstore mock server.
โถ๏ธ Start Petstore Mock Serverโ
The Petstore agent includes a built-in mock server for testing:
# Start the mock server
docker run -d -p 8080:8080 swaggerapi/petstore3
๐ Configure Environmentโ
Create a .env
file with your configuration:
# Agent Configuration
AGENT_NAME=petstore_agent
LLM_PROVIDER=azure-openai
# Petstore API Configuration
PETSTORE_API_URL=http://localhost:8080
PETSTORE_API_KEY=test-key
# A2A Configuration
A2A_AGENT_HOST=localhost
A2A_AGENT_PORT=8000
# MCP Configuration
MCP_HOST=localhost
MCP_PORT=9000
Local Developmentโ
# Navigate to the Template agent directory
cd ai_platform_engineering/agents/template
# Run the MCP server in stdio mode
make run-a2a
๐ Test Petstore Operationsโ
# Test basic pet operations
curl -X GET "http://localhost:8080/api/v3/pet/findByStatus?status=available"
curl -X GET "http://localhost:8080/api/v3/pet/1"
Run Petstore Sanity testsโ
make petstore-sanity
โจ Featuresโ
- Pet Management: Create, read, update, and delete pet records
- Pet Search: Find pets by status, tags, or other criteria
- Pet Store Operations: Manage pet store inventory and operations
- Mock Server Integration: Built-in mock server for testing and development
- API Testing: Test REST API operations with sample data
- Development Template: Use as a template for creating new agents
- MCP Server: Full Petstore API coverage through MCP tools
๐ฏ Example Use Casesโ
Ask the agent natural language questions like:
- Pet Operations: "Add a new dog named 'Buddy' to the pet store"
- Pet Search: "Find all available cats in the store"
- Pet Management: "Update the status of pet ID 123 to 'sold'"
- Inventory Management: "Show me all pets with the tag 'premium'"
- Store Operations: "List all pets that need to be fed today"
- API Testing: "Test the pet creation endpoint with sample data"
๐ฏ Customization Guideโ
Agent-Specific Configurationโ
- Update Agent Name: Replace "template" with your agent name
- Configure API Integration: Add your specific API endpoints and authentication
- Customize Prompts: Modify system prompts and user interactions
- Add Tools: Implement agent-specific tools and utilities
- Update Documentation: Customize README and documentation
MCP Server Customizationโ
- API Specification: Provide your OpenAPI specification
- Tool Selection: Choose which API endpoints to expose as tools
- Authentication: Configure authentication methods
- Error Handling: Implement custom error handling logic
Testing and Evaluationโ
- Unit Tests: Add tests for your specific functionality
- Integration Tests: Test against your API endpoints
- Evaluation Suite: Create evaluation prompts and expected outputs
- Performance Testing: Test agent performance and response times
๐ Documentationโ
For more detailed information about creating agents, please refer to: