Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62935b0

Browse files
committed
adding step 3
Signed-off-by: AnnaGutowska <[email protected]>
1 parent 102d415 commit 62935b0

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

react-agent-it-support/react-agent-tutorial.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Within LangGraph, the “state” feature serves as a memory bank that records a
2222

2323
## Steps
2424

25-
### Step 1. Set up your environment
25+
### Step 1. Generate your watsonx.ai credentials
2626
While you can choose from several tools, this tutorial walks you through how to set up an IBM account to use a Jupyter Notebook.
2727

2828
1. Log in to [watsonx.ai](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx&apps=all) using your IBM Cloud® account.
@@ -65,16 +65,32 @@ export PYTHONPATH=$(pwd):${PYTHONPATH}
6565

6666
To set up your environment, follow along with the instructions in the [README.md](https://github.com/IBM/watsonx-developer-hub/tree/main/agents/base/langgraph-react-agent) file on Github. This set up requires several commands to be run on your IDE or command line.
6767

68+
### Step 3. Set the environment variables
6869

69-
### Step 3. Upload your data to IBM Cloud Object Storage
70+
In the `config.toml` file, you will find the following blank credentials that must be filled in before attempting to deploy your agent. Your `watsonx_apikey` and `watsonx_url` were initialized in step 1 of this tutorial. Next, follow along with the simple form found on the [Developer Access](https://dataplatform.cloud.ibm.com/developer-access) page to select your deployment space or create a new one. There, you can retrieve your `space_id` needed to connect our agent to the watsonx.ai deployment. Lastly, your `model_id` is set to the IBM Granite 3.2 model.
71+
72+
```
73+
[deployment]
74+
watsonx_apikey = ""
75+
watsonx_url = "" # should follow the format: `https://{REGION}.ml.cloud.ibm.com`
76+
space_id = "" # found in the "Manage" tab of your Deployment or in the Developer Access page here: https://dataplatform.cloud.ibm.com/developer-access
77+
78+
[deployment.custom]
79+
# during creation of deployment additional parameters can be provided inside `CUSTOM` object for further referencing
80+
# please refer to the API docs: https://cloud.ibm.com/apidocs/machine-learning-cp#deployments-create
81+
model_id = "ibm/granite-3-2-8b-instruct"
82+
thread_id = "thread-1" # More info here: https://langchain-ai.github.io/langgraph/how-tos/persistence/
83+
```
84+
85+
### Step 4. Upload your data to IBM Cloud Object Storage
7086

7187
Our agent requires a data source to provide up-to-date information and add new data. We will store our data file in IBM Cloud® Object Storage.
7288

7389
1. First, log in to [IBM Cloud](https://cloud.ibm.com/objectstorage/overview). Then, create a [new project](https://cloud.ibm.com/projects).
7490
2. In the left-side menu, select [Resource list](https://cloud.ibm.com/resources). Using the Create resource button, create a new Cloud Object Storage instance or simply use [this link](https://cloud.ibm.com/objectstorage/create?catalog_query=aHR0cHM6Ly9jbG91ZC5pYm0uY29tL2NhdGFsb2c%2FY2F0ZWdvcnk9c3RvcmFnZSNhbGxfcHJvZHVjdHM%3D).
7591
3. Open your newly created IBM Cloud Storage Instance, create a new bucket. For this tutorial, you can select the Smart Tier which is the free tier. When directed, upload your file. For the sample file, refer to the tickets.csv file in the [GitHub repository](https://github.com/IBM/ibmdotcom-tutorials).
7692

77-
### Step 4. Establish your data connection
93+
### Step 5. Establish your data connection
7894

7995
To provide the ReAct agent with IT ticket management functionality, we must connect to our data source in IBM Cloud Object Storage. For this step, we can use the [`ibm_boto3` library](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-python).
8096

@@ -95,7 +111,7 @@ In `tools.py`, the `COS_ENDPOINT`, `COS_INSTANCE_CRN`, `BUCKET_NAME` and `CSV_FI
95111
)
96112
```
97113

98-
### Step 5. Create your custom tools
114+
### Step 6. Create your custom tools
99115

100116
Our agent will be able to both read and write data in our file. First, let's create the tool to read data using the LangChain `@tool` decorator.
101117

@@ -175,9 +191,7 @@ One last tool we must add to our `tools.py` file is the `get_todays_date` tool w
175191

176192
These tools are imported in the `agent.py` file and passed to the prebuilt LangGraph `create_react_agent` function serving as the agent executor. Other parameters include the large language model initialized by using the `ChatWatsonx` class which allows for tool calling on watsonx.ai, the memory saver and system prompt. Note, some prompts will behave better than others and so, some level of prompt engineering might be required depending on the LLM you choose.
177193

178-
Before deploying your agent, remember to complete all the necessary information in the `config.toml` file.
179-
180-
### Step 6. Chat with your agent
194+
### Step 7. Chat with your agent
181195

182196
There are three ways to chat with your agent.
183197

0 commit comments

Comments
 (0)