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

# Fal

**FalTools** 使 Agent 能够执行媒体生成任务。

## 先决条件

以下示例需要 `fal_client` 库和一个 API 密钥，您可从 [Fal](https://fal.ai/) 获取。

```shell theme={null}
pip install -U fal_client
```

```shell theme={null}
export FAL_KEY=***
```

## 示例

以下 agent 将使用 FAL 生成用户请求的任何视频。

```python cookbook/tools/fal_tools.py theme={null}
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.fal import FalTools

fal_agent = Agent(
    name="Fal Video Generator Agent",
    model=OpenAIChat(id="gpt-4o"),
    tools=[FalTools("fal-ai/hunyuan-video")],
    description="You are an AI agent that can generate videos using the Fal API.",
    instructions=[
        "When the user asks you to create a video, use the `generate_media` tool to create the video.",
        "Return the URL as raw to the user.",
        "Don't convert video URL to markdown or anything else.",
    ],
    markdown=True,
    debug_mode=True,
    show_tool_calls=True,
)

fal_agent.print_response("Generate video of balloon in the ocean")
```

## Toolkit 参数

| 参数        | 类型    | 默认值    | 描述              |
| --------- | ----- | ------ | --------------- |
| `api_key` | `str` | `None` | 用于身份验证的 API 密钥。 |
| `model`   | `str` | `None` | 用于媒体生成的模型。      |

## Toolkit 函数

| 函数               | 描述             |
| ---------------- | -------------- |
| `generate_media` | 根据用户提示生成图像或视频。 |
| `image_to_image` | 根据文本提示转换输入图像。  |

## 开发者资源

* 查看 [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/fal.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/fal_tools.py)
