Tagged “Agents”

14 posts · View all tags
Give each MCP tool its own scope, and return a refusal the client can act on
IntermediatePart 10

Give each MCP tool its own scope, and return a refusal the client can act on

Part 6 gated the whole server with one scope, which meant the token that let an agent look up a customer also let it issue refunds. Splitting that per tool is easy. Making the refusal useful is not: the obvious implementation returns HTTP 200 with the error buried in the body, so a client has nothing to trigger step-up authorization on. Getting the 403 and WWW-Authenticate challenge the spec defines means leaving the framework's abstraction entirely — and the version that does it decodes the token a second time, unverified.

Agentsself-hostingmcpsecurity
September 18, 202612 min read
Read more
Sandbox the code your agent writes, and prove every limit actually applied
IntermediatePart 9

Sandbox the code your agent writes, and prove every limit actually applied

OWASP names running model-generated code through exec or eval as its own vulnerability, tells you to treat the model as untrusted — and says nothing about how to contain it. So we built the containment: no network, 256 MB, 64 processes, read-only disk, no capabilities. Every one of those held. The CPU limit was refused outright, and eight busy loops took 605% of the host. The cause is one line of systemd configuration nobody mentions, and the fix needed no reboot despite the documentation insisting otherwise.

Agentsself-hostingdockersecurity
September 17, 202610 min read
Read more
Move the Docker daemon off root so a container escape lands on an ordinary user
IntermediatePart 8

Move the Docker daemon off root so a container escape lands on an ordinary user

If you can run docker without sudo, you can already read every file on the machine. Not through a bug — that is how Docker is built. One command proves it. For a host running agents that execute generated code, that is the whole attack, and Part 2's non-root containers do not touch it. This moves the daemon itself to an unprivileged account, with the UID arithmetic you can check, four places the install walks you into a wall on Ubuntu, and what stops working afterwards.

Agentsself-hostingdockersecurity
September 16, 202612 min read
Read more
Firewall an agent container so it can reach one API and nothing else
IntermediatePart 7

Firewall an agent container so it can reach one API and nothing else

Every part of this series so far has controlled what an agent may call. None of it controls where an agent may go. OWASP's mitigations for Excessive Agency are three rules about tools and say nothing about the network. This puts a default-deny egress policy in front of one container, allows exactly one API, and proves the boundary with a lookup that succeeds and a packet that dies. Includes the conntrack rule everyone tells you to add and this one doesn't need, and a measurement that was wrong by three orders of magnitude.

Agentsself-hostingdockersecurity
September 15, 202620 min read
Read more
The wrong valid token: authenticating an MCP tools server with authentik
IntermediatePart 6

The wrong valid token: authenticating an MCP tools server with authentik

Agent orchestration part 4 scoped tools in the client and admitted the server still trusted whoever reached the port. This puts a JWT verifier in front of it, with its own authentik client, so the tools server refuses anonymous callers — and refuses the gateway's own valid token, because a separate provider means a separate issuer. Includes the documented client-credentials helper that cannot work here, and the four silent 404s it produces instead of saying so.

Agentsself-hostingmcpsecurity
September 10, 202616 min read
Read more
The key that expires: giving an agent its own identity at the gateway
IntermediatePart 5

The key that expires: giving an agent its own identity at the gateway

Part 4 ended with a shell, a static key and a model that answered. This replaces that key with a token your identity provider issues, that carries a scope, and that dies after five minutes. authentik issues it over client credentials, the gateway verifies it in twenty-five lines, and three status codes prove the boundary. Includes the requirement authentik doesn't document, and the licence wall you hit if you follow LiteLLM's own guide.

Agentsgatewaylitellmsecurity
September 8, 202618 min read
Read more
Split one MCP toolbox between two agents so the scheduler cannot issue refunds
IntermediatePart 4

Split one MCP toolbox between two agents so the scheduler cannot issue refunds

Part 3 handed one agent all five tools and let a human pause guard the dangerous one. That guard depends on the model asking. This splits the same MCP server between a scheduler and a billing agent, so the scheduler cannot refund an invoice for the simplest reason available — the tool was never in its list. Then the supervisor goes back on top, and routing turns out not to be the guarantee.

AIAgentsself-hostingmcp
September 4, 202613 min read
Read more
Book appointments and refund invoices from a LangGraph agent over MCP
IntermediatePart 3

Book appointments and refund invoices from a LangGraph agent over MCP

The scheduler and billing agents from Parts 1 and 2 never actually scheduled or billed anything. This gives them a calendar, a customer list and a refund that no model can issue alone — over MCP, on the stateless spec, with the model on WEC Inference. Includes three things nobody documents: your server still defaults to sessions, ctx.elicit is the old API and its era error goes to the model, not to you, and cache=True does nothing unless the server advertises a TTL.

AIAgentsself-hostingmcp
September 3, 202621 min read
Read more
Checkpoint a LangGraph agent on a WEC Instance so crashes cost you nothing
IntermediatePart 1

Checkpoint a LangGraph agent on a WEC Instance so crashes cost you nothing

Persist agent state to Postgres on a WEC Instance, call a model on the WEC Inference API, then kill the process mid-run twice and resume both times from exactly where it stopped — plus the human-approval pause, and the interrupt that silently fires your side effects twice.

AIAgentsself-hostinglanggraph
August 26, 202621 min read
Read more
Hand work between LangGraph agents without corrupting shared state
IntermediatePart 2

Hand work between LangGraph agents without corrupting shared state

A supervisor routes work to specialists, an agent hands off mid-task, and two agents write the same state key in the same step. One of those raises an error rather than picking a winner — and the routing decision costs 412 output tokens to say one word.

AIAgentsself-hostinglanggraph
August 26, 202618 min read
Read more
Root by default: hardening container privilege on a self-hosted AI stack
IntermediatePart 2

Root by default: hardening container privilege on a self-hosted AI stack

Two of the six containers behind a live Langfuse deployment were running as root, for no reason anyone chose. Fixing it took one line each — and broke a service that had nothing to do with the fix. A real conversion, a real coordination failure, and how to catch both.

Agentsself-hostingdockersecurity
August 10, 20268 min read
Read more
Your firewall is lying to you: hardening Docker networks for multi-agent systems
IntermediatePart 1

Your firewall is lying to you: hardening Docker networks for multi-agent systems

A box running five agent stacks, a firewall set to deny everything, and services still answering from the public internet. We probe a real deployment, find a database with no password, prove why UFW never sees Docker traffic, and fix it four ways — every command and result from a live run.

Agentsself-hostingdockersecurity
August 3, 202614 min read
Read more
Component-level tracing: debugging agent tool calls
IntermediatePart 7

Component-level tracing: debugging agent tool calls

Your agent's thinking and its actions are two different layers. Build a tool-calling agent on WEC Inference, trace it with Langfuse, then debug two real failures from the trace — including the confident, wrong answer that never throws a stack trace.

AIAgentsinferenceevals
July 22, 202613 min read
Read more
Self-host the Hermes Agent with persistent memory
IntermediatePart 1

Self-host the Hermes Agent with persistent memory

Deploy Nous Research's open-source Hermes Agent on your WEC Instance — with SQLite-backed persistent memory that survives a full reboot. Real install, model config, and a memory-survives-restart test.

AIAgentsself-hostinghermes
June 25, 202612 min read
Read more