A Streamlit application that transforms OpenAPI specifications into intelligent AI agents capable of understanding natural language queries and executing API calls automatically.
- Natural Language API Interaction: Ask APIs questions in plain English instead of reading documentation 1
- Automatic Endpoint Discovery: AI agent analyzes OpenAPI specs and finds the right endpoints for your queries 2
- Authentication Handling: Automatic detection and configuration of API authentication schemes 3
- Request Parameter Generation: Auto-fills API parameters based on natural language understanding 4
The application supports three coordination patterns for handling multiple APIs simultaneously:
- Coordinator Pattern: Central control evaluates all APIs and selects the best match 5
- Mesh Pattern: Primary API with peer consultation for complex queries 6
- Service Discovery Pattern: Directory-based API selection 7
- Interactive Forms: Dynamic form generation for API parameters 8
- Request History: Track and review previous API interactions 9
- cURL Export: Generate cURL commands for API requests 10
- Real-time Authentication Status: Monitor API authentication configuration 11
- Python 3.8+
- Google Gemini API key
- OpenAPI 3.0 specification files (YAML or JSON)
- Clone the repository
- Install dependencies (requirements need to be documented)
- Set up environment variables:
GEMINI_API_KEY=your_gemini_api_key_here
The application uses Google Gemini for natural language processing 12 . Configure your API key either in a .env
file or Streamlit secrets 13 .
streamlit run app.py
- Upload OpenAPI Specs: Use the sidebar to upload one or more OpenAPI 3.0 specification files 14
- Select Active API: Choose which API to interact with 15
- Choose Coordination Pattern: For multiple APIs, select how they should coordinate 16
- Ask Natural Language Questions: Type your request in plain English 17
- Review and Execute: The AI will suggest an API call which you can review and execute 18
- Main Application: Streamlit-based user interface and workflow orchestration 19
- Gemini Agent: Natural language processing and endpoint matching 20
- Coordination Engine: Multi-API pattern implementations 21
- OpenAPI Utils: Specification parsing and validation 22
- Authentication Module: Security scheme handling 3
- Maximum history entries: 10 23
- Gemini model: gemini-1.5-flash 24
- Request timeout: 30 seconds 25
- Confidence thresholds for coordination patterns 26
api-as-agent/
├── app.py # Main Streamlit application
├── config.py # Configuration and constants
├── gemini_agent.py # AI agent implementation
├── coordination.py # Multi-API coordination patterns
├── openapi_utils.py # OpenAPI specification utilities
├── auth.py # Authentication handling
├── api_request.py # API request execution
├── ui_components.py # UI component functions
├── utils.py # General utilities
├── .devcontainer/ # Development container configuration
└── LICENSE # License file
This project implements the API-as-an-AI-Agent (5*A) concept and still under the development.