> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linkup.so/llms.txt
> Use this file to discover all available pages before exploring further.

# LlamaIndex

> How to use Linkup in LlamaIndex

## Overview

Linkup can be used with [LlamaIndex](https://www.llamaindex.ai/) to create advanced AI agents and workflows based on internal and web data.

## Getting Started with Linkup in LLamaIndex

**1. Get your Linkup API Key**

> [card] [Get your API key](https://app.linkup.so)
>
> Create a Linkup account for free to get your API key.

**2. Install dependencies**

```shell theme={"system"}
pip install llama-index llama-index-tools-linkup-research
```

**3. Create your agent**

```python theme={"system"}
from llama_index.core.agent import FunctionCallingAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.linkup_research.base import LinkupToolSpec

# Tool initialization
linkup_tool = LinkupToolSpec(
    api_key="<YOUR LINKUP API KEY>",
    depth="standard", # Options: "flash", "fast", "standard" or "deep"
    output_type="searchResults", # Options: "searchResults", "sourcedAnswer", or "structured"
)
```

> [!NOTE]
>
> | Parameter | Options | Description |
> | - | - | - |
> | `depth` | `"flash"`, `"fast"`, `"standard"`, `"deep"` | Controls search depth. `"flash"` is currently in alpha and offers the lowest latency (under 200 ms, no LLM). `"fast"` is higher-quality one-shot retrieval (\~1s, no LLM). `"standard"` leverages agentic search. `"deep"` performs more thorough research. |
> | `outputType` | `"searchResults"`, `"sourcedAnswer"`, `"structured"` | Determines the format of returned information. |

**4. Initialize and run your agent**

```python theme={"system"}
# Agent initialization
agent = FunctionCallingAgent.from_tools(
    linkup_tool.to_tool_list(),
    llm=OpenAI(
      api_key="<YOUR OPENAI API KEY>",
      model="gpt-4o-mini"
    ),
)

# Agent invocation
response = agent.chat("Can you tell me which women were awarded the Physics Nobel Prize")
print(response)
```

## Example Response

```python theme={"system"}
# Sample output
{
  "response": "Marie Curie (1903), Maria Goeppert Mayer (1963), Donna Strickland (2018), and Andrea Ghez (2020) have been awarded the Nobel Prize in Physics.",
  "sources": [
    # Source information would appear here
  ]
}
```

> [!NOTE]
>
> **Need help?** Email `support@linkup.so`, ping us on [Discord](https://discord.com/invite/9q9mCYJa86), or [talk to us](https://calendar.app.google/zNUZz7RxgMMk9pKW7).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.