> ## 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.

# Cal.com

## 先决条件

以下示例需要 `pytz` 和 `requests` 库。

```shell theme={null}
pip install requests pytz
```

```shell theme={null}
export CALCOM_API_KEY="your_api_key"
export CALCOM_EVENT_TYPE_ID="your_event_type_id"
```

## 示例

以下代理将使用 Cal.com 列出您 Cal.com 账户中明天的所有事件。

```python cookbook/tools/calcom_tools.py theme={null}

agent = Agent(
    name="Calendar Assistant",
    instructions=[
        f"你是日程安排助手。今天是 {datetime.now()}。",
        "你可以通过以下方式帮助用户：",
        "- 查找可用时间段",
        "- 创建新的预订",
        "- 管理现有预订（查看、重新安排、取消）",
        "- 获取预订详情",
        "- 重要提示：在重新安排或取消预订时，请调用 get_upcoming_bookings 函数以获取预订 ID。在为给定时间进行预订之前，请检查可用时段。",
        "在进行预订或更改之前，请务必确认重要详细信息。",
    ],
    model=OpenAIChat(id="gpt-4"),
    tools=[CalComTools(user_timezone="America/New_York")],
    show_tool_calls=True,
    markdown=True,
)

agent.print_response("我明天的预订有哪些？")
```

## Toolkit 参数

| 参数                      | 类型     | 默认值    | 描述                            |
| ----------------------- | ------ | ------ | ----------------------------- |
| `api_key`               | `str`  | `None` | Cal.com API 密钥                |
| `event_type_id`         | `int`  | `None` | 用于调度的事件类型 ID                  |
| `user_timezone`         | `str`  | `None` | 用户的时区（例如，“America/New\_York”） |
| `get_available_slots`   | `bool` | `True` | 启用获取可用时间段                     |
| `create_booking`        | `bool` | `True` | 启用创建新预订                       |
| `get_upcoming_bookings` | `bool` | `True` | 启用获取即将进行的预订                   |
| `reschedule_booking`    | `bool` | `True` | 启用重新安排预订                      |
| `cancel_booking`        | `bool` | `True` | 启用取消预订                        |

## Toolkit 函数

| 函数                      | 描述             |
| ----------------------- | -------------- |
| `get_available_slots`   | 获取给定日期范围的可用时间段 |
| `create_booking`        | 使用提供的详细信息创建新预订 |
| `get_upcoming_bookings` | 获取即将进行的预订列表    |
| `get_booking_details`   | 获取特定预订的详细信息    |
| `reschedule_booking`    | 重新安排现有预订       |
| `cancel_booking`        | 取消现有预订         |

## 开发者资源

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