File tree Expand file tree Collapse file tree 4 files changed +1493
-1448
lines changed
samples/company-research-agent Expand file tree Collapse file tree 4 files changed +1493
-1448
lines changed Original file line number Diff line number Diff line change 1+ FROM ghcr.io/astral-sh/uv:python3.12-alpine
2+
3+ # Set working directory
4+ WORKDIR /app
5+
6+ # Copy project files
7+ COPY pyproject.toml uv.lock ./
8+ COPY main.py ./
9+ COPY README.md ./
10+
11+ # Install dependencies
12+ RUN uv sync
13+
14+ # Create environment file from build args
15+ ARG CLIENT_ID
16+ ARG CLIENT_SECRET
17+ ARG BASE_URL
18+
19+ # Validate required environment variables
20+ RUN if [ -z "$CLIENT_ID" ]; then echo "CLIENT_ID build arg is required" && exit 1; fi
21+ RUN if [ -z "$CLIENT_SECRET" ]; then echo "CLIENT_SECRET build arg is required" && exit 1; fi
22+ RUN if [ -z "$BASE_URL" ]; then echo "BASE_URL build arg is required" && exit 1; fi
23+
24+ # Set environment variables for runtime
25+ ENV CLIENT_ID=$CLIENT_ID
26+ ENV CLIENT_SECRET=$CLIENT_SECRET
27+ ENV BASE_URL=$BASE_URL
28+ ENV TAVILY_API_KEY=${TAVILY_API_KEY:-"" }
29+
30+
31+ # Authenticate with UiPath during build
32+ RUN uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
33+
34+ RUN uv run uipath run agent '{\" company_name\" :\" uipath\" }'
Original file line number Diff line number Diff line change 1+ import os
12from langchain_anthropic import ChatAnthropic
23from langchain_community .tools .tavily_search import TavilySearchResults
4+ from langchain_community .tools import DuckDuckGoSearchResults
35from langgraph .graph import END , START , MessagesState , StateGraph
46from langgraph .prebuilt import create_react_agent
57from pydantic import BaseModel
8+ from uipath_langchain .chat import UiPathAzureChatOpenAI
69
710# Set up the Tavily search tool
8- tavily_tool = TavilySearchResults (max_results = 5 )
11+ if os .getenv ("TAVILY_API_KEY" ):
12+ tool = TavilySearchResults (max_results = 5 )
13+ else :
14+ tool = DuckDuckGoSearchResults (max_results = 5 )
915
1016# Define system prompt
1117system_prompt = """You are an advanced AI assistant specializing in corporate research and outreach strategy development. Your primary functions are:
2935
3036DO NOT do any math as specified in your instructions.
3137"""
38+ llm = UiPathAzureChatOpenAI (model = "gpt-4o-2024-08-06" )
39+ # llm = ChatAnthropic(model="claude-3-5-sonnet-latest")
3240
33- llm = ChatAnthropic (model = "claude-3-5-sonnet-latest" )
34-
35- research_agent = create_react_agent (llm , tools = [tavily_tool ], prompt = system_prompt )
41+ research_agent = create_react_agent (llm , tools = [tool ], prompt = system_prompt )
3642
3743
3844class GraphState (BaseModel ):
Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ name = "company-research-agent"
33version = " 0.0.1"
44description = " Company research agent with Tavily web search"
55authors = [{ name = " John Doe" , email = " john.doe@myemail.com" }]
6+
67requires-python = " >=3.10"
78dependencies = [
89 " langgraph>=0.2.55" ,
910 " langchain-anthropic>=0.3.8" ,
1011 " tavily-python>=0.5.0" ,
11- " uipath-langchain==0.0.113"
12+ " uipath-langchain==0.0.113" ,
13+ " uipath>=2.0.72" ,
1214]
1315
1416[project .optional-dependencies ]
You can’t perform that action at this time.
0 commit comments