Back to blog
Engineering6 min read

Let agents use secrets without teaching them to reveal secrets

Environment variables can stay opaque while programs still receive the credentials they need inside a sandbox.

By Hivy engineering

Hivy journal006
Engineering6 min read

The short version

  • Treat every automated run as an inspectable session.
  • Pass secrets to programs without printing their values.
  • End idle compute quickly and preserve the useful output.
  • Measure retries and tool failures beside model cost.

Make runtime behaviour visible

Agent infrastructure gets expensive in the gaps: idle sandboxes, repeated tool calls, oversized context, and retries that never change the plan. A completed answer hides those details unless the run keeps them attached.

Store the request, tool activity, duration, model cost, and final state as one session. Engineers can then fix the part that failed instead of replacing the whole agent.

Protect the runtime boundaries

Programs may need credentials, but the agent doesn't need to read their values. Provide variable names, pass values through the sandbox environment, and block commands that expose the environment in logs or messages.

Continue reading

Agent memory works better when part of it looks like a database

Next post

Put it into practice

Build the agent your team needs.