I have a problem and I need help. I have 2 agents. The first one suggests keywords and stores them as JSON and passes them through Kafka. But how do I make the second agent, whose code is below, see the data sent to it by the first agent?
class SignleSearchResult(BaseModel):
title: str
url: str = Field(…, title=“the page url”)
content: str
score: float
search_query: str
class AllSearchResults(BaseModel):
results: List[SignleSearchResult]
@tool
def search_engine_tool(query: str):
“”“Useful for search-based queries. Use this to find current information about any query related pages using a search engine”“”
print(f"Searching for: {query}") # لتتبع الاستعلامات
return search_client.search(query)
search_engine_agent = Agent(
role=“Search Engine Agent”,
goal=“To search for products based on the suggested search query”,
backstory=“The agent is designed to help in looking for products by searching for products based on the suggested search queries.”,
llm=basic_llm,
verbose=True,
tools=[search_engine_tool]
)
search_engine_task = Task(
description=“\n”.join([
“The task is to search for products based on the suggested search queries.”,
“You have to collect results from multiple search queries.”,
“Ignore any susbicious links or not an ecommerce single product website link.”,
“Ignore any search results with confidence score less than ({score_th}) .”,
“The search results will be used to compare prices of products from different websites.”,
]),
expected_output=“A JSON object containing the search results.”,
output_json=AllSearchResults,
output_file=os.path.join(output_dir, “step_2_search_results.json”),
agent=search_engine_agent
)
Accumed_crew1 = Crew(
agents=[
search_engine_agent,
],
tasks=[
search_engine_task,
],
process=Process.sequential,
knowledge_sources=[company_context]
)
crew_results = Accumed_crew1.kickoff(
inputs={
“score_th”: 0.10
}
)