How utkarsh050505/instagram-agent works
This is a web-based Instagram automation assistant. A user submits a goal in the browser UI; the Flask-SocketIO app queues it, and an Agent uses Gemini to choose and run registered tools against a Playwright page. The tools perform Instagram account search, follow/unfollow, and follower-list operations. Separate action routines implement richer workflows such as top-account discovery and messaging, but the sampled Agent registry does not show them being invoked. The app also streams browser frames and logs back to the UI. Unsampled templates and action internals limit detail.
Main entry points: app.py WebSocket app · browser.py Playwright browser · agent.py Goal agent · tools.py Account tools
Components 13
Web interface
- Chat and screen
instagram_agent/static/js/main.js - Web page
instagram_agent/templates/index.html
Task orchestration
- WebSocket app
instagram_agent/app.py - Goal agent
instagram_agent/agent.py
Instagram automation
- Account tools
instagram_agent/tools.py - Discovery and messaging
instagram_agent/actions.py - Playwright browser
instagram_agent/browser.py - Instagram helpers
instagram_agent/instagram_helpers.py
AI and configuration
- Gemini integration
instagram_agent/llm.py - Credentials and settings
instagram_agent/config.py
Other components
- User
- Gemini service
Connections 19
- User → Chat and screen: enters goals
instagram_agent/static/js/main.js - Chat and screen → WebSocket app: sends events
instagram_agent/static/js/main.js - WebSocket app → Chat and screen: emits frames and logs
instagram_agent/app.py - WebSocket app → Web page: renders page
instagram_agent/app.py - WebSocket app → Goal agent: runs queued goal
instagram_agent/app.py - WebSocket app → Playwright browser: launches browser
instagram_agent/app.py - Goal agent → Gemini integration: requests decisions
instagram_agent/agent.py - Goal agent → Account tools: dispatches tools
instagram_agent/agent.py - Goal agent → Credentials and settings: reads credentials
instagram_agent/agent.py - Gemini integration → Credentials and settings: reads model settings
instagram_agent/llm.py - Gemini integration → Gemini service: generates content
instagram_agent/llm.py - Account tools → Playwright browser: uses browser helpers
instagram_agent/tools.py - Account tools → Instagram helpers: uses account operations
instagram_agent/tools.py - Discovery and messaging → Playwright browser: uses browser helpers
instagram_agent/actions.py - Discovery and messaging → Instagram helpers: uses account operations
instagram_agent/actions.py - Playwright browser → Instagram helpers: uses Instagram home
instagram_agent/browser.py - Account tools → Instagram: operates account
- Discovery and messaging → Instagram: navigates and messages
- Playwright browser → Instagram: controls page