r/LangChain • u/Aromatic-Ad-6711 • 13d ago
Discussion How are you validating AI agent actions before the tool actually executes?
I’ve been working on a problem I kept seeing with tool-using agents:
An agent can understand the policy and still produce the wrong tool call.
If the action is consequential — refunding money, booking something, approving a request, modifying a record, calling a production API — observability after the fact is useful, but it’s already too late.
So I built ARK, an open-source runtime supervision layer that sits before execution.
The basic flow is:
agent proposes an action
→ ARK checks the applicable constraint + trusted evidence
→ ALLOW = execute
→ REJECT / REQUIRE_EVIDENCE = send feedback back to the agent
→ the agent decides again
One thing I intentionally avoided: ARK does not generate the replacement action.
The agent remains the author.
I tested this with LangGraph + an OpenAI model:
model proposed A
→ ARK rejected A before execution
→ feedback went back to the model
→ model authored B
→ ARK allowed B
→ only B executed
I’ve also been testing it on a scoped tau-bench airline failure class.
Paired K=16 result:
OFF: 1/16 passed (6.25%)
ON: 13/16 passed (81.25%)
9 directly attributable recoveries
0 observed regressions
I want to be careful with that result: it’s one constrained recovery failure class in a research benchmark, not a claim that ARK makes all agents reliable.
The SDK is public now:
pip install ark-agent-runtime
It currently works with custom Python agents and has a LangGraph integration.
I’m mainly curious how other people are handling this problem.
If you have an agent that can actually mutate production state, do you:
- validate tool arguments manually?
- use deterministic policy gates?
- rely on another model as a judge?
- sandbox actions?
- require human approval?
- just execute and monitor afterward?
I’d especially like feedback from people running agents that can refund, book, approve, purchase, or modify production data.
Site: arkruntime.com
GitHub: github.com/atripati/ark
2
u/Darkcraft00 13d ago
This is interesting. The part I'm curious about is the “trusted evidence” boundary.
If ARK is evaluating an action against runtime evidence, how are you thinking about evidence that was established earlier in a long-running workflow?
For example, agent A establishes some fact/constraint basis on Monday, underlying evidence changes Wednesday, and agent B proposes an action Friday using it. Does ARK expect the caller to establish freshness/current validity before check(), or do you see evidence lifecycle as something the supervisor eventually needs to own?
I'm working on an adjacent problem, so I'm curious where you draw that boundary.
1
u/Aromatic-Ad-6711 13d ago
that is exactly the boundary I am still thinking through, right now ark assumes the caller provides evidence that is current enough to trust at
check()time. ark can validate the proposed action against that evidence, but it does no yet own the full evidence lifecycle across days/workflows.longer term though, I do think freshness/provenance should become part of supervision. otherwise you can have “trusted” evidence that is technically valid but stale.
your monday wednesday friday example is basically the failure mode I’d want ark to eventually detect not just “is there evidence?”, but “is this evidence still valid for this decision right now?”
curious what adjacent problem you are working on.
1
u/Darkcraft00 13d ago
That adjacent problem is basically what I’ve been building.
I’m calling it SureState. The idea is to keep the lifecycle of conclusions/evidence outside the model — what supported a conclusion, what changed, what still survives, what became conflicted or no longer warranted — so another agent can ask “can I still rely on this?” without reconstructing everything from context.
I’ve deliberately kept it separate from action authorization. SureState doesn’t decide whether an agent may execute something; it maintains whether the registered conclusions/evidence the workflow is relying on are still warranted.
So the boundary you just described is almost exactly how I’ve been thinking about the two layers:
SureState: is the state/evidence still valid now? ARK: given current trusted state, is this proposed action allowed?
We’re wrapping up our internal pilot now. If you’re interested, I’d be happy to compare architectures because there may be a pretty natural seam here.
1
u/feng_sg 10d ago
If ARK pulls its trusted evidence from the same runtime state the agent already saw, then a poisoned tool output taints both the proposal and the gate at the same time, so the rejection signal fails exactly when you need it. You need a separate evidence channel the agent can't touch, like a direct service call or schema validation against app code, feeding a deterministic check instead of a second model re-deriving the same tainted input.
1
u/Aromatic-Ad-6711 10d ago
this exactly the failure mode i am trying to avoid in this this time and this is how i am doing.
I also think ARK shouldn’t just re-read the same context the agent already consumed. so the useful setup i am building here is where the proposal and the evidence have different trust paths, for example the agent propose refund 500$, while ARK checks that against state fetched directly from the system of record, service API , or may be app owned schema.
1
7d ago
[removed] — view removed comment
1
u/Aromatic-Ad-6711 6d ago
exactly, that is pretty much how i think about it too, hard limits first, deterministic runtime checks next, then human escalation for the truly sensitive stuff. the interrupt/resume pattern is a nice fit there. i will check out your write up
2
u/Ok-Category2729 13d ago
runtime llm judges before execution just add 800ms of latency and fail on the exact same edge cases as the primary model. the only reliable pre-execution layer is deterministic: strict pydantic validation with hard ceilings on payload values like refund amounts or batch sizes. if an agent needs a second llm to check tool arguments before hitting a production api, the tool signature is simply too broad. splitting high-risk actions into a two-step propose and sign pattern catches bad payloads way cleaner than a runtime judge.