Example

from phi.agent import Agent
from phi.llm.anthropic import Claude
from phi.tools.duckduckgo import DuckDuckGo

agent = Agent(
    llm=Claude(model="claude-3-opus-20240229"),
    tools=[DuckDuckGo()],
    show_tool_calls=True,
)
agent.print_response("Whats happening in France?", markdown=True)

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.

2

Install libraries

pip install -U anthropic duckduckgo-search phidata
3

Export `ANTHROPIC_API_KEY`

export ANTHROPIC_API_KEY=xxx
4

Run Claude Agent

python cookbook/llms/claude/agent.py

Information