# AI Agent

**AI Agent** is the central intelligence block in K3 Labs workflows, allowing you to connect your favorite AI model, set a custom prompt, and have the AI analyze, summarize, or take actions based on your blockchain data. You can use AI Agent for both simple and advanced automation tasks, making it a flexible tool for all types of users.

***

### How AI Agent Works

**1. Choose Your AI Provider**

You can select from the following AI providers:

* **Gemini (K3 Free Credits)** — Use Gemini for free, sponsored by K3 Labs. You will have access to Gemini 2.0 Flash and Gemini 2.0 Flash Light models.
* **Gemini** — Use your own Gemini API key.
* **OpenAI** — Connect your OpenAI account.
* **Claude** — Connect your Claude (Anthropic) account.

> **Tip:** To connect external providers (OpenAI, Claude, Gemini), go to the Integrations page, select your provider, and securely add your API key as shown below:

<figure><img src="/files/pseXcAZofEYLwhnyuabs" alt=""><figcaption></figcaption></figure>

All API keys are fully encrypted, and only used for generating responses within your workflows.

**2. Select Your AI Model**

Once you pick a provider, you’ll see all the latest available models (e.g., Gemini 2.0 Flash, GPT-4o, Claude 3 Opus, etc). K3 automatically keeps the list up to date as new models are released.

> **Choosing the Right Model**\
> Each AI model has its strengths and limitations. For example, basic models (like Gemini 2.0 Flash or ChatGPT 4.0) are great for simple, direct tasks—they’ll try a single operation and return a result. More advanced models (like Claude Sonnet 4.0, Gemini 2.5 Pro, or OpenAI GPT-4o) are capable of multi-step reasoning: if they encounter errors, they can adjust, retry queries, and refine their approach until they succeed. This means your workflow results can vary depending on which model you use.

**3. Write Your AI Prompt**

Your prompt tells the AI what to do with your data. Here are two typical ways to use AI Agent:

***

#### **A. Using AI Agent Without Tools (Prompt-Only Mode)**

\| <div><figure><img src="/files/i2rIvu2oJVyY6gej3bxX" alt=""><figcaption></figcaption></figure></div> | <p></p><p>In this mode, the AI only works with the data you pass it (no external tools used).</p><p><strong>Example 1: Wallet Balance Summary</strong></p><ul><li>Use the “AI Wallet Balance Summary” template to generate a daily summary of your wallet token holdings.</li><li>The workflow fetches wallet balances (using the <code>Read Wallet Balances</code> function), sends them to the AI Agent, and emails you a short, human-friendly report.</li><li><p>Example prompt:</p><pre><code>You are my financial assistant preparing a daily wallet report.
\[Prompt continues...] </code></pre></li><li><p><strong>Other use cases:</strong></p><ul><li>Transaction screening (“Summarize suspicious transactions from last 24 hours”)</li><li>Monitoring NFT activity</li><li>Generating portfolio insights</li><li>Formatting data for compliance reports</li></ul></li></ul> |
\| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

***

#### **B. Using AI Agent With Tools (Tool-Enabled Mode)**

This is where AI Agent gets really powerful. When you enable tools, the AI can call external services to fetch, analyze, or act on blockchain and off-chain data—making your workflows much more dynamic.

**How It Works:**

* Choose an AI tool from the dropdown after writing your prompt.
* Supported tools (so far):
  * **Web3 Data Fetcher** (Uniblock): Lets the AI fetch on-chain data, such as historical prices, wallet transactions, and more.
  * **MCP Server**: Lets the AI call any compatible tool or service configured as an MCP (using SSE endpoint + authentication). Example: connect to The Graph, or any third-party API set up as MCP.

**Example 2: Fetching Blockchain Data**

* Prompt:\
  `Show me the historical price of WBTC for May 26th 2024 on Ethereum.`
* Tool:\
  `Web3 Data Fetcher`
* Result:\
  The AI fetches and summarizes the price, so you can use it further in your workflow.

<figure><img src="/files/B88B6g92E0VnhGreYiHH" alt="" width="356"><figcaption></figcaption></figure>

**More tool use cases:**

* Pulling on-chain analytics or liquidity data
* Running cross-chain comparisons
* Querying specialized services (with MCP)
* Triggering actions based on real-time blockchain events

***

### Want to learn more?&#x20;

[Learn more about Web3 Data Fetcher.](/introduction/ai-automation-suite/ai-agent/web3-data-fetcher-tool-powered-by-uniblock.md)

[Learn more about configuring MCP tools.](/introduction/ai-automation-suite/mcp-server.md)

***

#### Connecting New Tools

With MCP support, you can connect virtually any external tool or service that supports MCP SSE integration and authentication - opening the door to custom analytics, custom APIs, and more. Just provide your endpoint and credentials, and the AI Agent can use it in your automations.

***

#### What’s Next?

We’re rapidly expanding the list of supported AI tools. You’ll see new pre-configured tools rolling out all the time, and you can already use MCP to connect your own. Stay tuned for updates!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.k3-labs.com/introduction/ai-automation-suite/ai-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
