Inspiration

Agent runtimes can produce valuable execution evidence, but raw runtime events may contain sensitive information. At the same time, simply hiding information in the frontend does not provide protection at the point where the data is produced.

We wanted to build a lightweight middleware layer that could sit in the backend/runtime path and make Agent Runs both safer and easier to understand.

What We Built

We extended Agent Launchpad with a trace-redaction middleware that processes runtime events before they are persisted and presented as Glass Box evidence.

The flow is:

Frontend → Fastify API → AgentService → Codex Runtime → Runtime Events → Trace Redaction → Run Evidence

The middleware uses redactEvent() to sanitize event content and redactText() to protect final Agent output. The resulting sanitized events are stored as part of the Run timeline, allowing operators to inspect what happened during an Agent Run without relying only on frontend filtering.

We also added structured Run lifecycle events such as queued, started, completed, and failed, making the execution timeline easier to follow.

How We Built It

We integrated the middleware into the existing AgentService and Codex Runner execution path rather than implementing protection only in the UI.

For the normal scenario, we used a real Agent task:

Create a TypeScript hello-world CLI, add a test, and run it.

The Agent creates the TypeScript project, runs the tests, and produces structured runtime evidence through the Glass Box.

We also demonstrated a failure scenario where the runtime encounters a 401 Unauthorized error. The failure is captured in the Run timeline through structured events including the Codex error, runtime exit, and failed Run state.

Automated tests were added for the redaction behavior and the surrounding Agent Run functionality.

What We Learned

This project taught us that observability and security need to be considered together in Agent systems.

A useful execution trace should contain enough information to diagnose what happened, but it should not blindly expose everything produced by the runtime. Placing the redaction logic in the backend/runtime path gives the middleware an enforcement point before evidence reaches persistent storage or the browser.

We also learned how to integrate middleware into an existing Agent execution pipeline while preserving the platform's existing lifecycle and runtime behavior.

Challenges

One challenge was identifying the right interception point. We wanted redaction to happen in the execution path rather than after data had already reached the frontend.

Another challenge was preserving useful diagnostic information while sanitizing potentially sensitive content. The goal was not to remove entire events, but to keep the structure and meaning of the Run timeline while protecting sensitive values.

Finally, we needed to handle both successful and failed executions consistently so that failures remained understandable and diagnosable.

Result

The final POC demonstrates a real Agent Run from the Playground, structured Glass Box evidence, backend/runtime trace redaction, and a failure path.

The result is a lightweight middleware layer that makes Agent execution more observable, safer, and easier to understand.

Built With

Share this project:

Updates

Submission history