-
Notifications
You must be signed in to change notification settings - Fork 77
Add examples of agent using Tavily server with key #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds two new example files demonstrating how to use the Tavily MCP server with API key authentication, and makes consistency improvements to related agent files.
Key Changes:
- Adds LangChain and Agent Framework examples showing Tavily search integration with Bearer token authentication
- Improves code consistency by standardizing logger names and moving logger.setLevel() calls to be immediately after logger creation
- Simplifies code by removing unused imports and inlining constants
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
agents/langchainv1_tavily.py |
New LangChain example demonstrating Tavily MCP integration with API key authentication |
agents/agentframework_tavily.py |
New Agent Framework example demonstrating Tavily MCP integration with API key authentication |
agents/langchainv1_http.py |
Fixed logger name from "itinerario_lang" to "langchainv1_http" and moved setLevel() for consistency |
agents/agentframework_learn.py |
Removed unused imports, fixed logger name, moved setLevel(), and inlined constant for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Load environment variables | ||
| load_dotenv(override=True) | ||
|
|
||
| api_host = os.getenv("API_HOST", "github") |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name api_host should follow Python naming conventions for constants that are module-level configuration values. Since this value is determined at module load time and used to configure the model, it should be named API_HOST (all uppercase) to be consistent with other similar files in the codebase (e.g., langchainv1_http.py line 27, agentframework_tavily.py line 22).
| model = ChatOpenAI( | ||
| model=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"), | ||
| base_url=os.environ["AZURE_OPENAI_ENDPOINT"] + "/openai/v1/", | ||
| api_key=token_provider, | ||
| ) | ||
| elif api_host == "github": | ||
| model = ChatOpenAI( | ||
| model=os.getenv("GITHUB_MODEL", "gpt-4o"), | ||
| base_url="https://models.inference.ai.azure.com", | ||
| api_key=SecretStr(os.environ["GITHUB_TOKEN"]), | ||
| ) | ||
| elif api_host == "ollama": | ||
| model = ChatOpenAI( | ||
| model=os.environ.get("OLLAMA_MODEL", "llama3.1"), | ||
| base_url=os.environ.get("OLLAMA_ENDPOINT", "http://localhost:11434/v1"), | ||
| api_key=SecretStr(os.environ.get("OLLAMA_API_KEY", "none")), | ||
| ) | ||
| else: | ||
| model = ChatOpenAI(model=os.getenv("OPENAI_MODEL", "gpt-4o-mini")) |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name model is inconsistent with similar files in the codebase. For example, langchainv1_http.py uses base_model for the same purpose. Using a more specific name like base_model or llm would improve code clarity and consistency across the codebase.
madebygps
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Similar to Learn, but demonstrates use of a key.
Also made some consistency tweaks with related agents.