
While building AI agents, I kept running into the same uncomfortable question: How do I guarantee an...
While building AI agents, I kept running into the same uncomfortable question:
How do I guarantee an agent execution will stop?
Not “usually stop.” Not “log when it goes wrong.” But actually guarantee it won’t run forever, retry endlessly or burn money in a loop.
Most agent frameworks focus on reasoning quality. I was more worried about runaway execution.
That’s what led me to build AgenWatch.
What the problem actually is
If you’ve worked with agents, you’ve probably seen this:
Observability helps explain what happened. It does nothing to stop it.
I didn’t want better logs. I wanted runtime enforcement.
In operating systems, we don’t trust processes to behave correctly. We enforce limits:
I applied the same idea to AI agents.
Instead of trusting the LLM to stop, I built a runtime execution kernel that decides:
That kernel became AgenWatch.
AgenWatch is:
AgenWatch is not:
This is a basic example showing runtime budget enforcement.
import os
from agenwatch import Agent, tool
from agenwatch.providers import OpenAIProvider
@tool("Echo input text")
def echo(**kwargs) -> dict:
text = kwargs.get("text", "")
return {"echo": text}
agent = Agent(
tools=[echo],
llm=OpenAIProvider(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4o-mini"
),
budget=1.0,
max_iterations=5
)
result = agent.run("Echo hello")
print(f"Success: {result.success}")
print(f"Cost: {result.cost}")
print(f"Output: {result.output}")
If the budget or iteration limit is exceeded, the kernel blocks the next call before it executes.
LangChain can generate tasks and prompts. AgenWatch governs execution.
import os
from langchain_core.prompts import ChatPromptTemplate
from agenwatch import Agent, tool
from agenwatch.providers import OpenAIProvider
@tool("Echo text safely")
def echo(**kwargs) -> dict:
return {"echo": kwargs.get("text", "")}
agent = Agent(
tools=[echo],
llm=OpenAIProvider(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4o-mini"
),
budget=1.0,
max_iterations=3
)
prompt = ChatPromptTemplate.from_messages([
("human", "Say hello using the echo tool")
])
task = prompt.format_messages()[0].content
result = agent.run(task)
print(result.success, result.cost, result.output)
LangChain handles what to do. AgenWatch enforces whether it’s allowed to continue.
In v0.1.x, AgenWatch:
If a hard limit is hit mid-execution, AgenWatch freezes and reports. Rollback is an orchestration concern, not a kernel concern.
I built AgenWatch because I needed hard execution guarantees, not better explanations after failure.
It’s early. It’s intentionally narrow. But it already solved a real production problem for me.
If you’re building agents and care about:
you might find it useful.
GitHub: https://github.com/agenwatch/agenwatch
PyPI: https://pypi.org/project/agenwatch/
gemmaI ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...
communityHey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...
ai(yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...
aiMy laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...
githubactionsI Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...
aiI've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...
Workflows from the Neura Market marketplace related to this DeepSeek resource