An AI-powered browser automation agent that automates product return workflows across e-commerce platforms like Amazon and Flipkart.
Built with Stagehand (Browserbase's AI browser automation SDK), the agent uses natural language instructions instead of brittle CSS selectors, making it more resilient to UI changes and easier to maintain.
+----------------------+
| Returns_Tasks.xlsx |
+----------+-----------+
|
▼
Agent Orchestrator
|
+----------------+----------------+
| |
▼ ▼
Amazon Adapter Flipkart Adapter
| |
+----------------+----------------+
|
▼
Stagehand Client
|
▼
Browserbase Session
|
▼
Live Website Actions
|
▼
Structured Result
|
▼
Update Excel Task Sheet
Read Pending Tasks
↓
Group Items by Order
↓
Launch Browser Session
↓
Detect Platform Flow
↓
Perform Return Workflow
↓
Extract Return Details
↓
Update Task Sheet
↓
Close Session
returns_agent/
├── agent.py
├── config.py
├── excel_io.py
├── stagehand_client.py
├── platforms/
├── tools/
├── tasks/
└── logs/
pip install -r requirements.txtexport BROWSERBASE_API_KEY=your_browserbase_api_key
export BROWSERBASE_PROJECT_ID=your_browserbase_project_id
export MODEL_API_KEY=your_openrouter_api_keypython agent.py- AI-powered browser automation using Stagehand
- Natural language actions instead of CSS selectors
- Supports multiple e-commerce platforms through adapters
- Automatic workflow detection
- Structured data extraction
- Per-item fault tolerance
- Automatic task tracking in Excel
- Modular and extensible architecture