Agent Mode introduces a significant shift in how you build within Opal.
Before, Opal helped you chain prompts and different models together into a
custom workflow. Now, your Opal is powered by an **agent** capable of
executing much more open-ended and complex tasks based on the prompt
objective you give it.

## Create an Opal with Agent Mode

The Agent is the most powerful way to build a mini-app that can handle
complex tasks, use memory, and coordinate multiple steps. This guide will
walk you through setting up an Agent using the visual editor.

### Step-by-Step Setup

1. **Start Your Journey:** Click the **Create New** button on the Opal homepage to open a fresh canvas in the visual editor.
2. **Add a Generation Step:** Click **Generate** at the top of the editor. This creates a new generation node on your map and opens the sidebar.
3. **Select the Agent Model:** In the sidebar, click the model drop-down menu and select **Agent**. This gives your Opal advanced reasoning and tool-use capabilities.
4. **Natural Language Description:** Click into the prompt area and explain your idea. The Agent will use your instructions to build out the logic of your app.
   - *Example:* "Create a research agent that inputs a company name, uses `@Search` to find their latest mission statement, and then generates a witty social media bio."
5. **Test and Preview:** Once processed, the visual map updates with connections. Click the background of the editor and check the **Preview** section in the sidebar to try it out.

> **Pro Tip:** Agent mode is enabled by default.

## Harness Agent Skills and Memory

The real power of an Agent lies in its ability to use **Memory** and
**External Skills**. By incorporating these into your prompt, your
mini-app becomes a dynamic tool.

### Create with Memory and Skills

**Tool Menu:** Use the `@` symbol in the prompt area to pull up a menu
of available skills.

- **Complex Workflows:** Describe a flow that requires multiple actions.
  - *Example:* "Build a research tool to `@Search` for top 3 travel trends for 2026. Use `@Memory` to remember these trends, and then use `@Veo` to generate an 8-second teaser video."

### How it Works

Once the Agent processes a complex request, it automatically creates the
necessary nodes (e.g., `Search` -\> `Memory` -\> `Veo`). You can test the
memory later by asking follow-up questions like: *"Write a blog post
based on the trends you found earlier."*

## Understand Agentic Steps and Tools

The Agent Toolkit allows your Opal to perform actions like generating
video, executing code, or remembering facts over time.

| Feature | Standard Workflow | Agent Mode |
|---|---|---|
| **Logic** | Linear / Chained Prompts | Open-ended / Reasoning |
| **Execution** | Manual Step Connection | Autonomous Coordination |
| **Capabilities** | Static Responses | Tool Use (Search, Video) |
| **Input** | Structured Prompts | Natural Language |

### The Agent Toolkit

| Tool | Capability |
|---|---|
| **Gemini 3** | Reasoning, code execution, and Google Search/Maps grounding. |
| **Veo 3.1** | High-fidelity video production with custom aspect ratios. |
| **Nano Banana** | Studio-quality image generation and precise visual editing. |
| **Gemini TTS** | Converts text into speech using distinct, high-quality voices. |
| **Lyria** | Specialized music generation for custom soundtracks. |
| **Search/Maps** | Real-time grounding for weather, location, and events. |
| **Code Exec** | Allows the Agent to run Python code for math or data tasks. |
| **Memory** | Enables your app to store and recall details across sessions. |

## 💡 Pro Tip: Writing Objective-Based Prompts

Building with an Agent differs from building with standard models. Focus on
the **Objective** rather than micro-tasks. The Agent uses reasoning to decide
which tools best reach your goal.

### Focus on the "What," Not the "How"

Clearly state the final result you want to achieve:

- **Avoid (Task-Based):** "First, click the search button, then look for 2026 trends, then save them, then write a summary."
- **Better (Objective-Based):** "Your goal is to become an expert on 2026   
  travel trends. Identify the top 3 trends and ensure they are saved."

### Use Your Toolkit

You can increase accuracy by explicitly mentioning tools in two ways:
1. **Natural Language:** Mention the tool by name (e.g., "Use Search and
Memory to..."). The Agent will recognize the intent.
2. **Tool Chips (@):** For maximum precision, use the `@` symbol to tag a
specific tool (e.g., "Use `@Search` to find news"). This "hard-links"
the tool and prevents hallucination.
> **Example Objective-Driven Prompt:**
> "Your objective is to act as a Project Manager for my website launch. Use
> `@Search` to find the current best practices for SEO in 2026, then
> save those facts to `@Memory`. If I ask for a status update, `@Go` to
> `[Summary_Step]`; otherwise, stay in `@Memory` mode."
>
> ## Persistent Memory
>
Opal has evolved beyond "one-and-done" interactions. With **Persistent
Memory**, your mini-apps log, update, and recall information across
different sessions.

### How Memory Transforms Your Mini-App

- **Eliminate "Warm-up" Time:** The Agent recalls previously gathered research so you can pick up exactly where you left off.
- **Persistent Preferences:** Set a preference once (e.g., "minimalist, cinematic aesthetic") and the Agent applies it to all future generations.
- **Project Lifecycle Awareness:** Store data one day (like travel trends) and use it to power a different output the next (like a social strategy).

## How to Activate and Manage Memory

Give your Agent "total recall" using the natural language editor or the
visual editor map.

### Invoke and Manage Data

**Use the @ Reference System:** In the prompt area, type `@Memory` or
"Use memory to..." This tells the Agent to check its internal database.

- **Natural Language Commands:** You can prompt the Agent to organize its own memory with commands like:
  - "List all the travel trends you've saved so far."
  - "Delete the entry about 'Space Tourism' and update it with 'Eco-trekking'."
- **Visual Editor Connections:** Drag a connection from a Generate step (like a web search) directly into a Memory node to ensure the output is saved.

> **Example: Plant Caretaker App**
> "Check memory for my 'Plant Collection.' If it doesn't exist, create a
> list. Whenever I show a photo of a new plant, identify it and add it.
> Remember the watering schedule so I can ask you later what needs care."
>
> ## Manage Your Agent's Memory
>
Memory is not permanent. You can instruct your Agent to edit, update, or
completely wipe stored information at any time.

### Edit or Delete Entries

- **Update existing memory:** "Update my 'Plant Collection' memory. My Snake Plant 'Sid' was actually watered today."
- **Delete a specific entry:** "Forget the travel trend about 'Space Tourism' from my 2026 research log."
- **Clear all memories:** "Clear all stored memories and reset my project history."

**Pro Tip: Auditing Your Memory**

Ask for a "Memory Audit" to see what is stored. Type: "List everything
you remember about my client meeting preferences." Review the output in
the Preview window, then use delete or edit commands to refine it.

## Example: Building a "Smart Garden" Mini-App

An Agent transforms a basic plant-care app into a personalized digital
garden by combining Vision, Memory, and Creative Skills.

- **Visual Recognition:** Use `@Vision` to identify species from photos.
- **Personalization:** `@Memory` recognizes specific plants by name (e.g., "Monty" the Money Tree) and tracks health history.
- **Multimedia Creation:**
  - **Nano Banana:** Generates stylized "Care Cards" with illustrations.
  - **Lyria:** Creates a custom "Lo-fi Garden" soundtrack for watering.

> **Try This Prompt:**
> "Create a plant care mini-app. Use `@Vision` to identify a plant, save
> its name and status to `@Memory`, and use `@Nano Banana` to generate
> a unique care instruction card."
>
> ## Routing: Giving Your Agent Decision-Making Power
>
Routing allows the Agent to choose a specific outgoing path based on
logic you define, turning your app into a smart flowchart.

### How to Use Routing

1. **Connect multiple wires:** Drag from the Agent step to two or more different nodes (e.g., "Success" and "Error").
2. **Access the Routing menu:** Select the Agent node and type `@` in the prompt area.
3. **Select the "Go to" chip:** Choose `@Go to` from the menu to reference specific connected steps.
4. **Define logic:** "Analyze the plant photo. If the plant looks healthy, `@Go to [Celebrate Step]`. If it looks wilted, `@Go to [Watering Advice Step]`." ## Why Use Routing?

Routing transforms your Opal from a linear process into a dynamic experience.

Instead of seeing every possible output, the user only sees the path
relevant to their specific input, making the mini-app feel much more
intelligent, responsive, and personal.

### Pro Tip: Advanced Example: The Persistent Travel Planner

Use If...then statements to create an app that distinguishes between a
"Discovery" phase and a "Planning" phase. This ensures the Agent doesn't
repeat research it has already done.

#### How to Build the Logic

1. **Visual Editor Setup:** Ensure your Agent node has two outgoing wires: one connected to a step named `[Destination Discovery]` and another to `[Itinerary Builder]`.
2. **Enter the Logic Prompt:** Select the Agent node and paste the following into the sidebar: \> "Ask the user where they want to travel. IF the destination is \> already saved in `@Memory`, THEN `@Go to [Itinerary Builder]` to \> start booking flights and hotels. IF the destination is new, THEN \> `@Go to [Destination Discovery]` to use `@Search` and find the \> top-rated hidden gems for that location." ### Why This Works
3. **Contextual Intelligence:** The app "recognizes" user progress. If they've already researched Tokyo, the app skips introductions and moves straight to logistics.
4. **Optimized Workflows:** Routing prevents the Agent from performing unnecessary `@Search` steps, saving time and increasing responsiveness.
5. **Seamless Memory Integration:** The Agent treats `@Memory` as a living database, updating it during the "Discovery" phase so that the "Builder" phase is ready the next time the user logs in.