--- 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: ```