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

Procura
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

Procura
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

Ren

Procura
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
This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.