Here's a step-by-step tutorial for setting up and deploying a project with wxflows
, including installing necessary tools, deploying the app, and running it locally.
This example consists of the following pieces:
- LangChain JS SDK (models)
- LangGraph JS SDK (agent)
- wxflows SDK (tools)
You can use any of the supported chat models.
This guide will walk you through installing the wxflows
CLI, initializing and deploying a project, and running the application locally. We’ll use google_books
and wikipedia
tools as examples for tool calling with wxflows
.
Begin by installing the wxflows
CLI tool. You can find installation instructions on the wxflows installation page:
-
Download the CLI from https://wxflows.ibm.stepzen.com/docs/installation
-
Create a new directory on your machine
-
Run the following command in this directory:
pip install wxflows_cli-1.0.0rc200-py3-none-any.whl --force-reinstall
Make sure to use the name of the
.whl
file you downloaded.This will install the latest version of the CLI from the downloaded
.whl
file. -
After installing, make sure to login to the CLI.
There's already a wxflows.toml
file in this repository that defines the following values:
- Defines an endpoint
api/examples-langgraph
for the project. - Imports
google_books
tool with a description for searching books and specifying fieldsbooks|book
. - Imports
wikipedia
tool with a description for Wikipedia searches and specifying fieldssearch|page
.
You can deploy this tool configuration to a Flows Engine endpoint by running:
wxflows deploy
This command deploys the endpoint and tools defined, these will be used by the wxflows
SDK in your application.
From the project’s root directory copy the sample environment file to create your .env
file:
cp .env.sample .env
Edit the .env
file and add your credentials, such as API keys and other required environment variables. Ensure the credentials are correct to allow the tools to authenticate and interact with external services.
To run the application you need to install the necessary dependencies:
npm i
This command installs all required packages, including the @wxflows/sdk
package and any dependencies specified in the project.
Copy the sample environment file to create your .env
file:
cp .env.sample .env
Edit the .env
file and add your credentials, such as API keys and other required environment variables. Ensure the credentials are correct to allow the tools to authenticate and interact with external services.
Finally, start the application by running:
npm start
This command initiates your application, allowing you to call and test the google_books
and wikipedia
tools through wxflows
.
You’ve now successfully set up, deployed, and run a wxflows
project with google_books
and wikipedia
tools. This setup provides a flexible environment to leverage external tools for data retrieval, allowing you to further build and expand your app with wxflows
. See the instructions in tools to add more tools or create your own tools from Databases, NoSQL, REST or GraphQL APIs.
Please reach out to us on Discord if you have any questions or want to share feedback. We'd love to hear from you!