# Local: Ollama must be running on your machine# Cloud: Set your Ollama API key for hosted inferenceexport OLLAMA_API_KEY="your-api-key"export TAVILY_API_KEY="your-tavily-api-key"
# Set the API key for your providerexport <PROVIDER>_API_KEY="your-api-key"export TAVILY_API_KEY="your-tavily-api-key"
Deep Agents 可与任何 LangChain 聊天模型 一起使用。请为您所选的提供商设置 API 密钥。
# System prompt to steer the agent to be an expert researcherresearch_instructions = """You are an expert researcher. Your job is to conduct thorough research and then write a polished report.You have access to an internet search tool as your primary means of gathering information.## `internet_search`Use this to run an internet search for a given query. You can specify the max number of results to return, the topic, and whether raw content should be included."""
以 provider:model 格式传入 model 字符串,或者传入一个已初始化的模型实例。请查看所有提供商的 支持模型列表 以及经过测试的 推荐模型。
result = agent.invoke({"messages": [{"role": "user", "content": "What is langgraph?"}]})# Print the agent's responseprint(result["messages"][-1].content)