Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions examples/mcp/databutton-mcp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from praisonaiagents import Agent, MCP
import os

# Databutton API key
databutton_api_key = os.getenv("DATABUTTON_API_KEY")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Consider adding error handling to check if the DATABUTTON_API_KEY environment variable is set. If it's not set, the agent will not function correctly. You could raise an exception or provide a default behavior.

Suggested change
databutton_api_key = os.getenv("DATABUTTON_API_KEY")
databutton_api_key = os.getenv("DATABUTTON_API_KEY")
if not databutton_api_key:
raise ValueError("DATABUTTON_API_KEY environment variable not set")


# Create databutton agent
databutton_agent = Agent(
instructions="""You are a helpful assistant that can interact with Databutton.
Use the available tools when relevant to answer user questions.""",
llm="gpt-4o-mini",
tools=MCP("uvx databutton-app-mcp@latest", env={"DATABUTTON_API_KEY": databutton_api_key})
)

databutton_agent.start("Get the current stock price for AAPL, Tesla, and Amazon")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a try...except block around the databutton_agent.start() call to catch potential exceptions during agent execution. This will prevent the program from crashing if something goes wrong.

Suggested change
databutton_agent.start("Get the current stock price for AAPL, Tesla, and Amazon")
try:
databutton_agent.start("Get the current stock price for AAPL, Tesla, and Amazon")
except Exception as e:
print(f"An error occurred: {e}")

12 changes: 12 additions & 0 deletions src/praisonai-agents/mcp-llama4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from praisonaiagents import Agent, MCP
import os

brave_api_key = os.getenv("BRAVE_API_KEY")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the Databutton agent, add error handling to check if the BRAVE_API_KEY environment variable is set. This will prevent the agent from failing silently if the key is missing.

brave_api_key = os.getenv("BRAVE_API_KEY")
if not brave_api_key:
    raise ValueError("BRAVE_API_KEY environment variable not set")


research_agent = Agent(
instructions="Research Agent",
llm="groq/meta-llama/llama-4-scout-17b-16e-instruct",
tools=MCP("npx -y @modelcontextprotocol/server-brave-search", env={"BRAVE_API_KEY": brave_api_key})
)

research_agent.start("What is the latest research on the topic of AI and its impact on society?")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add a try...except block around the research_agent.start() call to handle potential exceptions during agent execution.

try:
    research_agent.start("What is the latest research on the topic of AI and its impact on society?")
except Exception as e:
    print(f"An error occurred: {e}")

2 changes: 1 addition & 1 deletion src/praisonai-agents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "praisonaiagents"
version = "0.0.73"
version = "0.0.74"
description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
authors = [
{ name="Mervin Praison" }
Expand Down
Loading
Loading