Why should we need a gurdrails server? cant we use direct function

cant we directly use the gurdrails function & create our own class & use it in other framwork such as langgraph? if i want to use gurdrails so do i need to run the server every time?

Akash, direct functions work fine for small projects, but a guardrails server is better when we have multiple teams or applications because it keeps all the rules in one place, handles more users at once, and is easier to maintain.

Think of it like having one central security guard for a building instead of each room having its own guard - it’s more efficient and consistent.

You can directly use guardrails functions and create your own class to integrate with LangGraph or other frameworks. You don’t need to run a separate server every time - that’s actually the more straightforward approach for most cases.

The direct function approach means you just import the guardrails library into your code, create a wrapper class, and use it directly in LangGraph. The server is only needed if you have multiple different applications that all need the same guardrails, or if you want to share guardrails across different teams. For a single project or team, direct integration is simpler and faster.

For your current setup with LangGraph, I’d recommend going with direct functions first. It’s easier to implement, no extra server to maintain, and you can always switch to server mode later if you need to share guardrails across multiple projects.

Good luck!

we have diff api .diff teams workning on diff gen ai usecase. so here wha if we created simpler api endpoint &given input & output gurd .like calling this api will also wokr right?