SabaKore

Home / Articles / AI guides

Running AI Frameworks Like LangChain on a VPS

The role of frameworks that make it easier to build AI-powered apps, and how to deal with the extra dependencies you pick up when running them on a VPS.

Ren, a junior infrastructure engineer

Ren

I hear the name LangChain a lot, but what is it actually for?
Procura, a cloud AI robot who explains

Procura

It's a toolkit that lets you combine the parts that come up often in AI apps (keeping conversation history, searching documents before answering, calling external tools) without writing each one from scratch.

What changes when you use it

  • You don't have to rewrite the same processing every time
  • It's easy to try things while swapping parts in and out
  • In exchange, there's more to learn and more packages to depend on
Ren, a junior infrastructure engineer

Ren

It sounds handy, but is there anything to watch out for on the VPS side?
Procura, a cloud AI robot who explains

Procura

Frameworks like this are known for updating quickly. Because versions go up so often, things break from incompatibilities between the packages they depend on more easily than in ordinary apps.

Dealing with dependencies

It's important to keep a record of the environment as it's running. If you pin and save the combination of packages, you can reproduce the same state when you rebuild the environment later. If you keep installing 'whatever is newest at the time' without pinning anything, the cause is hard to trace when it suddenly stops working one day.

  • Pin the combination of packages you use in a file and keep it
  • Don't put updates straight into production; try them somewhere else first
  • Prepare a way to go back to the previous state in case things stop working

Separate production and testing

Because the tools update so quickly, it's worth keeping the place where you try things separate from the place you actually use. It can be on the same VPS, but run it in a different directory or a different container, and set up a flow where only what works gets reflected in the production settings. A setup where test results affect production directly makes every update stressful.

  • Prepare a testing environment separate from production
  • Try updates in the testing environment first and apply them only after confirming there are no problems
  • Record the date and content of what you applied (this makes it easier to isolate problems when they occur)
Procura, a cloud AI robot who explains

Procura

The speed of updates is also a sign that this field is still growing. Keeping up takes effort, but as long as you get in the habit of keeping records, you should be able to live with it without panicking.
Ren, a junior infrastructure engineer

Ren

Keeping up with every update sounds exhausting... is there a priority?
Procura, a cloud AI robot who explains

Procura

It's fine to prioritize security-related updates and take in feature additions in batches after waiting and watching for a while. You don't need to chase everything right away. Even just skimming the update history makes it much easier to judge how urgent something is.

Watch for log growth too

Frameworks like this are sometimes set to output detailed logs to make it easier to trace what is happening internally. That's useful during development, but if you keep outputting them in production, disk usage grows faster than expected. When you move to operation, review how detailed the logs are, and you can avoid the panic of noticing a lack of space later.

  • Make it possible to switch log detail between development and production
  • Set up a mechanism to check the capacity of the log storage regularly
  • Include a setting that automatically deletes old logs from the start
Ren, a junior infrastructure engineer

Ren

So in exchange for the convenience, there's more work to keep a record of the environment.

This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.