Skip to main content
Component: ExternalToolsMixin Module: gaia_agent_code.tools.external_tools Import: from gaia_agent_code.tools.external_tools import ExternalToolsMixin

Overview

ExternalToolsMixin provides integration with external MCP (Model Context Protocol) services for the Code Agent, enabling documentation lookup and web search capabilities with graceful fallback when services are unavailable. Key Features:
  • Context7 integration for library documentation search
  • Perplexity AI integration for web search
  • Graceful degradation when services unavailable
  • Clear guidance to LLM on fallback behavior
  • Optional tools (don’t block agent if unavailable)
Design Philosophy:
  • OPTIONAL TOOLS: Services may not be available, agent uses embedded knowledge
  • GRACEFUL FALLBACK: Clear instructions to LLM when service unavailable
  • ESCALATION STRATEGY: Try embedded knowledge first, escalate to user after 2 attempts

API Specification


Implementation Details

Context7 Integration with Graceful Fallback

Perplexity Integration


Service Configuration

Context7 Service

Perplexity Service


Testing Requirements

File: tests/agents/code/test_external_tools_mixin.py

Usage Examples

Example 1: Documentation Search with Fallback

Example 2: Web Search for Current Info

Example 3: Library-Specific Documentation


Environment Variables


Escalation Strategy

When external tools are unavailable:
  1. First Attempt: Use embedded knowledge from training data
  2. Second Attempt: Try alternative approach or reformulate
  3. After 2 Failures: Escalate to user with clear explanation
Example guidance:

ExternalToolsMixin Technical Specification