11<div style =" text-align : center ;" >
22
33![ LangGraph Logo] ( /images/langgraph_logo.svg )
4+
45# ReACT Agent
56
67</div >
78
89---
10+
911## What this agent does
10- General-purpose agent using a ReAct loop: it reasons and calls tools (e.g. search, math) step by step. Built with LangGraph and LangChain.
12+
13+ General-purpose agent using a ReAct loop: it reasons and calls tools (e.g. search, math) step by step. Built with
14+ LangGraph and LangChain.
1115
1216---
17+
1318### Preconditions:
14- - You need to copy/paste .env file and change its values to yours
19+
20+ - You need to change .env.template file to .env
1521- Decide what way you want to go ` local ` or ` RH OpenShift Cluster ` and fill needed values
1622- use ` ./init.sh ` that will add those values from .env to environment variables
1723
24+ Go to agent dir
1825
26+ ``` bash
27+ cd agents/base/langgraph_react_agent
28+ ```
29+
30+ Change the name of .env file
1931
20- Copy .env file
2132``` bash
22- cp template.env agents/base/langgraph_react_agent/ .env
33+ mv template.env .env
2334```
2435
2536#### Local
37+
2638Edit the ` .env ` file with your local configuration:
2739
2840```
@@ -33,6 +45,7 @@ CONTAINER_IMAGE=not-needed
3345```
3446
3547#### OpenShift Cluster
48+
3649Edit the ` .env ` file and fill in all required values:
3750
3851```
@@ -43,46 +56,47 @@ CONTAINER_IMAGE=quay.io/your-username/langgraph-react-agent:latest
4356```
4457
4558** Notes:**
59+
4660- ` API_KEY ` - contact your cluster administrator
4761- ` BASE_URL ` - should end with ` /v1 `
4862- ` MODEL_ID ` - contact your cluster administrator
4963- ` CONTAINER_IMAGE ` - full image path where the agent container will be pushed and pulled from.
5064 The image is built locally, pushed to this registry, and then deployed to OpenShift.
5165
5266 Format: ` <registry>/<namespace>/<image-name>:<tag> `
53-
54- Examples:
55- - Quay.io: ` quay.io/your-username/langgraph-react-agent:latest `
56- - Docker Hub: ` docker.io/your-username/langgraph-react-agent:latest `
57- - GHCR: ` ghcr.io/your-org/langgraph-react-agent:latest `
5867
59- Go to agent dir
60- ``` bash
61- cd agents/base/langgraph_react_agent
62- `` `
68+ Examples:
69+ - Quay.io: ` quay.io/your-username/langgraph-react-agent:latest `
70+ - Docker Hub: ` docker.io/your-username/langgraph-react-agent:latest `
71+ - GHCR: ` ghcr.io/your-org/langgraph-react-agent:latest `
6372
6473Create and activate a virtual environment (Python 3.12) in this directory using [ uv] ( https://docs.astral.sh/uv/ ) :
74+
6575``` bash
6676uv venv --python 3.12
6777source .venv/bin/activate
6878```
79+
6980(On Windows: ` .venv\Scripts\activate ` )
7081
7182Make scripts executable
83+
7284``` bash
7385chmod +x init.sh
7486```
7587
7688Add to values from .env to environment variables
89+
7790``` bash
78- ./init.sh
91+ source ./init.sh
7992```
8093
8194---
8295
8396## Local usage (Ollama + LlamaStack Server)
8497
8598Create package with agent and install it to venv
99+
86100``` bash
87101uv pip install -e .
88102```
@@ -92,75 +106,93 @@ uv pip install ollama
92106```
93107
94108Install app from Ollama site or via Brew
109+
95110``` bash
96111# brew install ollama
97112# or
98113curl -fsSL https://ollama.com/install.sh | sh
99114```
100115
101116Pull Required Model
117+
102118``` bash
103119ollama pull llama3.2:3b
104120```
105121
106122Start Ollama Service
123+
107124``` bash
108125ollama serve
109126```
110- > ** Keep this terminal open!** \
127+
128+ > ** Keep this terminal open!** \
111129> Ollama needs to keep running.
112130
113131Start LlamaStack Server
132+
114133``` bash
115134llama stack run ../../../run_llama_server.yaml
116135```
136+
117137> ** Keep this terminal open** - the server needs to keep running.\
118138> You should see output indicating the server started on ` http://localhost:8321 ` .
119139
120- Run the example:
140+ Run the example:
141+
121142``` bash
122143uv run examples/execute_ai_service_locally.py
123144```
124145
125146# Deployment on RedHat OpenShift Cluster
147+
126148Login to OC
149+
127150``` bash
128151oc login -u " login" -p " password" https://super-link-to-cluster:111
129152```
130- Login ex. Docker
153+
154+ Login ex. Docker
155+
131156``` bash
132157docker login -u=' login' -p=' password' quay.io
133158```
134159
135160Make deploy file executable
161+
136162``` bash
137163chmod +x deploy.sh
138164```
139165
140166Build image and deploy Agent
167+
141168``` bash
142169./deploy.sh
143170```
144171
145172This will:
173+
146174- Create Kubernetes secret for API key
147175- Build and push the Docker image
148176- Deploy the agent to OpenShift
149177- Create Service and Route
150178
151179COPY the route URL and PASTE into the CURL below
180+
152181``` bash
153182oc get route langgraph-react-agent -o jsonpath=' {.spec.host}'
154183```
155184
156185Send a test request:
186+
157187``` bash
158188curl -X POST https://< YOUR_ROUTE_URL> /chat \
159189 -H " Content-Type: application/json" \
160190 -d ' {"message": "What is the best company? Answer with the first correct answer."}'
161191```
162192
163193## Agent-Specific Documentation
194+
164195Each agent has detailed documentation for setup and deployment:
196+
165197- https://ollama.com/
166198- https://formulae.brew.sh/formula/ollama#default
0 commit comments