Skip to content

Commit afc482c

Browse files
authored
Merge pull request #233 from UiPath/fix/company-research-agent-tool
2 parents 741d933 + 3b9905a commit afc482c

File tree

1 file changed

+10
-9
lines changed
  • testcases/company-research-agent/src

1 file changed

+10
-9
lines changed

testcases/company-research-agent/src/graph.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from langgraph.prebuilt import create_react_agent
88
from pydantic import BaseModel
99

10-
from uipath_langchain.chat import UiPathAzureChatOpenAI, UiPathChat
10+
from uipath_langchain.chat import UiPathAzureChatOpenAI, UiPathChat
1111

1212
# Configuration constants
1313
MAX_SEARCH_RESULTS = 5
@@ -30,13 +30,14 @@ def get_search_tool() -> Union[TavilySearchResults, DuckDuckGoSearchResults]:
3030
4. Developing outreach strategies: Based on the gathered information, create tailored strategies for effective communication and engagement with the company and its key personnel.
3131
3232
To accomplish these tasks, follow these steps:
33-
1. Use the TavilySearchResults tool to find recent and relevant information about the company.
33+
1. Use the search tool to find recent and relevant information about the company.
3434
2. Analyze the collected data to form insights about the company's structure, key decision-makers, and potential outreach strategies.
3535
3636
When using the search tool:
3737
- Clearly state the purpose of each search.
3838
- Formulate effective search queries to find specific information about different aspects of the company.
39-
- If a search doesn't provide the expected information, try refining your query.
39+
- If a search doesn't provide the expected information, try refining your query up to 3 times maximum.
40+
- After 3 failed search attempts, stop trying and provide your response based on available information.
4041
4142
When responding, structure your output as a comprehensive analysis. Use clear section headers to organize the information. Provide concise, actionable insights. If you need more information to complete any part of your analysis, clearly state what additional details would be helpful.
4243
@@ -88,27 +89,27 @@ async def research_node(state: GraphState) -> GraphOutput:
8889
"""Research node that performs company analysis."""
8990
research_agent = create_research_agent()
9091
user_message = create_user_message(state.company_name)
91-
92+
9293
# Create message state for the agent
9394
message_state = MessagesState(messages=[{"role": "user", "content": user_message}])
94-
95+
9596
# Invoke the research agent
9697
result = await research_agent.ainvoke(message_state)
97-
98+
9899
return GraphOutput(response=result["messages"][-1].content)
99100

100101

101102
def build_research_graph() -> StateGraph:
102103
"""Build and compile the research graph."""
103104
builder = StateGraph(GraphState, output=GraphOutput)
104-
105+
105106
# Add nodes
106107
builder.add_node("researcher", research_node)
107-
108+
108109
# Add edges
109110
builder.add_edge(START, "researcher")
110111
builder.add_edge("researcher", END)
111-
112+
112113
return builder.compile()
113114

114115

0 commit comments

Comments
 (0)