This project demonstrates two approaches for integrating external API tools with Pydantic AI agents.
Uses Model Context Protocol (MCP) servers for tool integration. Tools are loaded from an external MCP server configured via .mcp.json.
Key Features:
- External tool server via MCP protocol
- Dynamic tool loading
- Configuration-driven approach
Directly initializes and registers connector tools within the agent code.
Key Features:
- In-memory tool registration
- Direct connector initialization
- Programmatic approach
- Python 3.12 or higher
- Environment variables configured (see below)
-
Clone or navigate to the project directory:
cd /path/to/example-api-tool-setup -
Run the setup script to create the shared virtual environment:
./setup.sh
This will:
- Create a shared
venv/directory at the project root - Install all required dependencies
- Set up the environment for both l1-mcp and l2-tool
- Create a shared
Both implementations share a single .env file at the project root. Copy the .env.example file as a starting point:
cp .env.example .env
# Edit .env and add your API keysRequired environment variables:
ANTHROPIC_API_KEY- Claude API keyGONG_ACCESS_KEY- Gong API access keyGONG_ACCESS_KEY_SECRET- Gong API secretLANGSMITH_*- (Optional) LangSmith tracing configurationAIRBYTE_*- Airbyte configuration for l2-tool direct integration
Both implementations use the same Gradio chat interface and can be run independently.
cd l1-mcp
./run.shcd l2-tool
./run.shThe Gradio interface will be available at: http://localhost:8000