> ## 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 工具

## 代码

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

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.calcom import CalComTools

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

agent.print_response("我明天有什么预约？")
```

## 用法

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="设置您的 API 密钥">
    ```bash theme={null}
    export CALCOM_API_KEY=xxx
    export CALCOM_EVENT_TYPE_ID=xxx
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="安装库">
    ```bash theme={null}
    pip install -U requests pytz openai agno
    ```
  </Step>

  <Step title="运行 Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/tools/calcom_tools.py
      ```

      ```bash Windows theme={null}
      python cookbook/tools/calcom_tools.py
      ```
    </CodeGroup>
  </Step>
</Steps>
