File size: 6,042 Bytes
ddcfd44
 
9e4359f
ddcfd44
 
 
 
 
 
 
 
 
744e5e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
title: EurekaAgent
emoji: πŸ€–
colorFrom: blue
colorTo: blue
sdk: gradio
sdk_version: 5.43.1
app_file: app.py
pinned: false
license: apache-2.0
---

# Eureka Agent

An AI-powered research automation system that can execute Python code, analyze data, and generate insights through an interactive Jupyter-like interface.

<img width="1936" height="855" alt="Screenshot 2025-08-22 at 11 45 12β€―PM" src="https://github.com/user-attachments/assets/8d4ea793-4027-4aa3-8d6f-cbebbbd6e0c2" />

## 🎯 What it does

Eureka Agent automates research workflows by:

- **Executing Python code** in a secure containerized environment
- **Analyzing data** with full context awareness across conversations
- **Generating visualizations** and interactive outputs
- **Iterative development** - builds upon previous code and results
- **Error recovery** - learns from execution failures and improves

## ⚑ Key Features

- **Stateful Jupyter Environment**: Variables and imports persist across all code executions
- **GPU/CPU Support**: Configurable hardware (CPU, T4, L4, A100, H100)
- **Interactive Development**: Build complex solutions incrementally
- **Rich Output Support**: Plots, tables, HTML, and multimedia content
- **Error Handling**: Intelligent error recovery and debugging assistance
- **File Upload**: Process your own datasets and documents

## πŸš€ Quick Start

### Prerequisites

- Python 3.8+
- Modal account (for containerized execution)
- OpenAI API key or compatible LLM provider

### Installation

1. Clone the repository:

```bash
git clone https://github.com/adithya-s-k/EurekaAgent
cd EurekaAgent
```

2. Install dependencies:

```bash
pip install -r requirements.txt
```

3. Set up environment variables:

```bash
export OPENAI_API_KEY="your-api-key"
export MODAL_TOKEN_ID="your-modal-token-id"
export MODAL_TOKEN_SECRET="your-modal-token-secret"
```

### Running the Application

```bash
python app.py
```

The application will launch a Gradio interface accessible via your web browser.

## πŸ”§ Configuration

### Environment Variables

| Variable                     | Description                   | Required | Format/Example                  |
| ---------------------------- | ----------------------------- | -------- | ------------------------------- |
| `MODAL_TOKEN_ID`             | Modal token ID                | Yes      | `ak-...`                        |
| `MODAL_TOKEN_SECRET`         | Modal token secret            | Yes      | `as-...`                        |
| `PROVIDER_API_KEY`           | AI Provider API key           | Yes\*    | `sk-...`, `gsk_...`, `csk-...`  |
| `PROVIDER_API_ENDPOINT`      | AI Provider API endpoint      | Yes\*    | `https://api.anthropic.com/v1/` |
| `MODEL_NAME`                 | Model to use                  | Yes\*    | `claude-sonnet-4-20250514`      |
| `HF_TOKEN`                   | Hugging Face token (optional) | No       | `hf_...`                        |
| `TAVILY_API_KEY`             | Tavily API key for web search | No       | `tvly-...`                      |
| `PHOENIX_API_KEY`            | Phoenix tracing API key       | No       | -                               |
| `PHOENIX_COLLECTOR_ENDPOINT` | Phoenix collector endpoint    | No       | -                               |
| `ENVIRONMENT`                | Environment mode              | No       | `dev`/`prod`                    |

\*At least one complete AI provider configuration must be provided

**Legacy OpenAI Support:**
| Variable | Description | Required |
| ----------------------- | ----------------------------- | -------- |
| `OPENAI_API_KEY` | OpenAI API key | No |
| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint | No |
| `AZURE_OPENAI_API_KEY` | Azure OpenAI API key | No |

### Hardware Options

- **CPU Only**: Free, suitable for basic tasks
- **NVIDIA T4**: Low-cost GPU for small models
- **NVIDIA L4**: Mid-range GPU for better performance
- **NVIDIA A100**: High-end GPU for large models (40GB/80GB variants)
- **NVIDIA H100**: Latest flagship GPU for maximum performance

## πŸ’‘ Usage Examples

### Basic Data Analysis

```
"Analyze the uploaded CSV file and create visualizations showing key trends"
```

### Machine Learning

```
"Train a neural network to classify the iris dataset and evaluate its performance"
```

### Research Tasks

```
"Download stock price data for the last year and perform technical analysis"
```

## πŸ—οΈ Architecture

- **Frontend**: Gradio web interface with real-time status updates
- **Backend**: Python application with multi-provider AI integration
- **Execution Environment**: Modal containerized sandboxes with GPU support
- **Code Execution**: Persistent Jupyter-like stateful environment
- **Session Management**: Comprehensive session state tracking with Phoenix tracing
- **Storage**: File-based session persistence with notebook compatibility
- **Web Search**: Integrated Tavily search for current information
- **Hardware Support**: CPU, T4, L4, A100, H100 configurations

## πŸ“ Project Structure

```
EurekaAgent/
β”œβ”€β”€ app.py              # Main Gradio application with API key management
β”œβ”€β”€ jupyter_handler.py  # Jupyter notebook management and rendering
β”œβ”€β”€ jupyter_agent.py           # Utility functions, execution logic, and session management
β”œβ”€β”€ modal_sandbox.py   # Modal sandbox configuration with GPU support
β”œβ”€β”€ system_prompt.txt  # System prompt for the AI agent
β”œβ”€β”€ requirements.txt   # Python dependencies
└── temp/              # Temporary files, notebooks, and session states
    β”œβ”€β”€ <session_id>/
    β”‚   β”œβ”€β”€ session_state.json    # Complete session state and history
    β”‚   └── jupyter-agent.ipynb   # Legacy notebook file for UI compatibility
    └── jupyter-agent.ipynb       # Default notebook template
```

## 🀝 Contributing

This project is a fork of [Jupyter Agent 2](https://huggingface.co/spaces/lvwerra/jupyter-agent-2) by Hugging Face. Contributions are welcome!

## πŸ“„ License

See [LICENSE](./LICENSE) file for details.