File size: 3,289 Bytes
52d7f2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Patent Architect AI v2
emoji: πŸ—οΈ
colorFrom: green
colorTo: yellow
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py
pinned: false
---

# πŸ—οΈ Patent Architect AI v2 - True Agentic Workflow

**An AI-powered system that uses a team of collaborating agents to transform a raw idea into a strategized patent draft.**

This application demonstrates a true multi-agent system where different AI agents, each with a specific role, negotiate and collaborate to produce a comprehensive patent application. It includes live prior art searches and multiple forms of AI-generated visual aids.

## 🎯 Key Features

### **πŸ€– True Agentic Collaboration**
A team of specialized AI agents work together, with the output of one agent influencing the actions of the next.
- **Prior Art Detective**: Performs *live* web searches on Google Patents and Wikipedia to find relevant prior art.
- **Chief Strategist**: Analyzes the prior art and formulates a defensible patenting strategy.
- **Technical Writer, Claims Drafter, Figure Drafter**: Generate the core sections of the patent, all adhering to the Chief Strategist's mandate.
- **Conceptual Artist**: Generates a high-quality conceptual image of the invention using the Segmind Ideogram API.

### **🎨 Dual Visual Outputs**
The system generates two distinct, real images to aid understanding:
- **Conceptual Image**: A photorealistic image from the Segmind API that helps visualize the invention's marketing potential.
- **Technical Figure**: A patent-style drawing rendered from real LaTeX/TikZ code, which is essential for the patent document itself.

### **πŸ’‘ From First Principles**
This application is built with a focus on robust, elegant design. It handles errors gracefully and makes agent interactions transparent, demonstrating a resilient and well-architected system.

---

## πŸš€ Getting Started

### 1. Install Dependencies
Ensure you have Python 3.8+ installed, then run:
```bash
pip install -r requirements.txt
```

### 2. Set Up API Keys (Crucial Step)
This application requires API keys to function. Your keys are not stored or shared.

#### **For Local Development:**
1.  **Create a `.env` file** in the main project directory.
2.  **Copy the text below** into your `.env` file.
3.  **Add your secret keys** in place of the placeholder text.

    ```
    # .env file for Patent Architect AI v2

    # Required for the core language model agents (Strategist, Writer, etc.)
    # Get a key from Google AI Studio: https://makersuite.google.com/app/apikey
    GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE"

    # Required for the PriorArtDetective agent to perform live web searches.
    # Get a free key from SerpApi: https://serpapi.com/
    SERPAPI_API_KEY="YOUR_SERPAPI_API_KEY_HERE"

    # Required for the ConceptualArtist agent to generate high-quality images.
    # Get a free key from Segmind: https://segmind.com/
    SEGMIND_API_KEY="YOUR_SEGMIND_API_KEY_HERE"
    ```

#### **For Hugging Face Spaces Deployment:**
1.  Do **not** upload your `.env` file.
2.  In your Space settings, go to the **"Secrets"** section.
3.  Add each of the three keys (`GEMINI_API_KEY`, `SERPAPI_API_KEY`, `SEGMIND_API_KEY`) as a separate secret.

### 3. Run the Application
Once your API keys are configured, run the app:
```