Update crew.py
Browse files
crew.py
CHANGED
@@ -7,6 +7,7 @@ import os
|
|
7 |
from crewai import Agent, Crew, Task
|
8 |
from crewai.agents.agent_builder.base_agent import BaseAgent
|
9 |
from crewai.project import CrewBase, agent, crew, task
|
|
|
10 |
from google import genai
|
11 |
from openinference.instrumentation.crewai import CrewAIInstrumentor
|
12 |
from phoenix.otel import register
|
@@ -51,6 +52,23 @@ class GAIACrew():
|
|
51 |
tools=[AITools.web_search_tool],
|
52 |
verbose=True
|
53 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
@agent
|
56 |
def image_analysis_agent(self) -> Agent:
|
@@ -159,7 +177,7 @@ class GAIACrew():
|
|
159 |
@crew
|
160 |
def crew(self) -> Crew:
|
161 |
return Crew(
|
162 |
-
agents=self.agents,
|
163 |
tasks=self.tasks,
|
164 |
verbose=True
|
165 |
)
|
|
|
7 |
from crewai import Agent, Crew, Task
|
8 |
from crewai.agents.agent_builder.base_agent import BaseAgent
|
9 |
from crewai.project import CrewBase, agent, crew, task
|
10 |
+
from crewai_tools import StagehandTool ###
|
11 |
from google import genai
|
12 |
from openinference.instrumentation.crewai import CrewAIInstrumentor
|
13 |
from phoenix.otel import register
|
|
|
52 |
tools=[AITools.web_search_tool],
|
53 |
verbose=True
|
54 |
)
|
55 |
+
|
56 |
+
with StagehandTool(
|
57 |
+
api_key=os.environ["BROWSERBASE_API_KEY"],
|
58 |
+
project_id=os.environ["BROWSERBASE_PROJECT_ID"],
|
59 |
+
model_api_key=os.environ["OPENAI_API_KEY"],
|
60 |
+
model_name="gpt-4.1"
|
61 |
+
) as web_browser_tool:
|
62 |
+
web_browser_agent = Agent(
|
63 |
+
role="Web Browser Agent",
|
64 |
+
goal="Given a question and URL, load the URL and act, extract, navigate, observe, and answer the question: {question}",
|
65 |
+
backstory="As an expert browser assistant, you load the URL and act, extract, navigate, observe to answer the question.",
|
66 |
+
allow_delegation=False,
|
67 |
+
llm=AGENT_MODEL,
|
68 |
+
max_iter=2,
|
69 |
+
tools=[web_browser_tool],
|
70 |
+
verbose=True
|
71 |
+
)
|
72 |
|
73 |
@agent
|
74 |
def image_analysis_agent(self) -> Agent:
|
|
|
177 |
@crew
|
178 |
def crew(self) -> Crew:
|
179 |
return Crew(
|
180 |
+
agents=[self.agents, web_browser_agent],
|
181 |
tasks=self.tasks,
|
182 |
verbose=True
|
183 |
)
|