Agent Connect is a FastAPI-based platform that enables secure, real-time two-way communication between mobile devices and PCs using AI agents. Send queries from your phone and receive intelligent responses or notifications, seamlessly bridging your devices.
- AI-Powered Crypto Analysis: Leverages Google's Gemini 2.0 Flash model to generate concise cryptocurrency market summaries
- REST API Endpoints: Simple endpoints for querying crypto data and triggering automated reports
- Push Notifications: Sends summarized crypto market updates directly to your devices via Pushcut
- Secure API Authentication: API key authentication to ensure secure access
- Text Formatting: Cleans up AI responses for optimal readability on notification services
Agent Connect is designed for seamless, scalable, two-way communication between your mobile device and PC using AI agents. The architecture supports both request/response and event-driven interactions.
iPhone (User/Siri Shortcut)
↓
Cloudflare Tunnel (Secure Public Endpoint)
↓
FastAPI Server (Agent Connect)
↓
AI Agent (Gemini LLM via Google ADK)
↓
Pushcut (Notification Service)
↓
iPhone (Receives Notification)
- The user sends a query from their iPhone (e.g., via Siri Shortcut or app).
- The request is securely routed through Cloudflare Tunnel to your FastAPI server running Agent Connect. Cloudflare Tunnel is free, but requires a domain name (which can be obtained from providers like Namecheap, DotTech, or others). If you don’t have a custom domain, you can use ngrok as an alternative to expose your local server. See the section below for setup details.
- FastAPI processes the request and forwards it to the AI Agent (Gemini LLM).
- The AI Agent generates a response (e.g., crypto price summary).
- The response is sent to Pushcut, which delivers a notification to the user’s iPhone.
- The user receives the AI-generated update as a push notification.
This flow supports two-way communication: users can send queries and receive real-time, AI-powered responses on their mobile device.
- Stateless API: FastAPI endpoints are stateless, making it easy to scale horizontally (multiple server instances behind a load balancer).
- Session Management: The agent uses session services, which can be backed by scalable storage (e.g., Redis) for multi-user support.
- Cloudflare Tunnel: Handles secure, scalable ingress without manual firewall or DNS management.
- Pushcut: Supports multiple devices and users, enabling broad notification delivery.
This design ensures the system can grow to support more users, devices, and real-time features as needed.
To make your local FastAPI server accessible from the internet (for mobile device communication), you need a secure tunneling solution.
- Requirements:
- A free Cloudflare account
- Install cloudflared on your machine
- Configure your tunnel and DNS as per Cloudflare documentation
- Benefits:
- Free for most use cases
- Secure, stable, and production-ready
- Custom domain support
- Requirements:
- ngrok account
- Download and install ngrok
choco install ngrok
ngrok config add-authtoken your_auth_token
- Workflow:
- Start your FastAPI server locally (e.g.,
python crypto_agent.py
) - In a new terminal, run:
ngrok http 8765
- ngrok will provide a public HTTPS URL (e.g.,
https://18d9-2a00-8a60-c010-1-b8c9-83dc-eae9-8881.ngrok-free.app
) - Use this URL in your mobile app or webhook configuration
- Start your FastAPI server locally (e.g.,
- Notes:
- Free tier has time/session limits and random URLs
- Paid plans offer custom domains and reserved URLs
Both Cloudflare Tunnel and ngrok allow you to securely test and deploy your agent for remote access from mobile devices or other clients.
Query the agent with a custom request
Headers:
x-api-key
: Your API key for authentication
Request Body:
{
"message": "What is the current price of Bitcoin?"
}
Trigger a standard cryptocurrency price update report
Headers:
x-api-key
: Your API key for authentication
- Python 3.9+
- Google API key (for Gemini AI)
- Pushcut API key
- Custom API key for securing your service
- Clone this repository:
git clone https://github.com/yourusername/crypto-price-agent.git
cd crypto-price-agent
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the root directory with the following variables:
GOOGLE_API_KEY=your_google_api_key
PUSHCUT_API_KEY=your_pushcut_api_key
MY_API_KEY=your_custom_api_key
python crypto_agent.py
The service will start on http://0.0.0.0:8765
.
The service can be exposed to the internet using Cloudflare Tunnel. A sample configuration is included in the project.
# Custom query
curl -X POST http://localhost:8765/agent-query \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"message": "Compare Bitcoin and Ethereum performance this week"}'
# Standard report
curl -X POST http://localhost:8765/run-agent \
-H "x-api-key: your_api_key"
- FastAPI: Web framework for building APIs
- Google ADK: Google's Agent Development Kit for LLM interactions
- Gemini 2.0: Google's large language model for natural language processing
- Pushcut: Mobile notification service
- Uvicorn: ASGI web server
MIT
- Google's Generative AI team for providing the Gemini model API
- Pushcut for notification services