Ollama + LangraphJs Agents

Tried out the capability of Langhgraph with Ollama, and built a rag agent, with different state. Its like State Machine, where each state can transition into a different state on certain actions.

App Dependency

We depend on following packages that would need us to create account and get API keys. The packages are:

After we have an account in the above sites, let's update the .env.example file with the API keys and rename it to .env.

Local Development

After we have the .env file updated we need to run npm install to install the dependencies. After that we can start the agent with npm start. The question to the chat agent is hard coded in the main.ts for now. Make sure you have Ollama server running locally.

What do we have ?

The Agent consist of following Workflow. The State Graph has 4 states:

Screenshots

Here is what the 2 flows will output