Skip to content

Commit 6854b7f

Browse files
committed
Dockerfile for company research agent
1 parent f2cc0e2 commit 6854b7f

File tree

4 files changed

+1493
-1448
lines changed

4 files changed

+1493
-1448
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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\"}'

samples/company-research-agent/graph.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
import os
12
from langchain_anthropic import ChatAnthropic
23
from langchain_community.tools.tavily_search import TavilySearchResults
4+
from langchain_community.tools import DuckDuckGoSearchResults
35
from langgraph.graph import END, START, MessagesState, StateGraph
46
from langgraph.prebuilt import create_react_agent
57
from 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
1117
system_prompt = """You are an advanced AI assistant specializing in corporate research and outreach strategy development. Your primary functions are:
@@ -29,10 +35,10 @@
2935
3036
DO 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

3844
class GraphState(BaseModel):

samples/company-research-agent/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ name = "company-research-agent"
33
version = "0.0.1"
44
description = "Company research agent with Tavily web search"
55
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
6+
67
requires-python = ">=3.10"
78
dependencies = [
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]

0 commit comments

Comments
 (0)