Condukt.Secrets (Condukt v0.16.5)

Copy Markdown View Source

Session-scoped secrets for agent tool execution.

Condukt.Secrets resolves trusted secret declarations into environment variables while a session starts. The resolved values are not added to the system prompt, user messages, or persisted session snapshots. Built-in tools receive them through their execution environment when they spawn commands.

Secret declarations

Configure secrets as a map or keyword list whose keys are the environment variable names exposed to tools:

MyApp.Agent.start_link(
  secrets: [
    GH_TOKEN: {:one_password, "op://Engineering/GitHub/token"},
    DATABASE_URL: {:env, "DATABASE_URL"}
  ]
)

The built-in provider aliases are:

Custom providers can be used directly:

secrets: [
  API_TOKEN: {MyApp.Secrets.Vault, path: "agents/api-token"}
]

Later declarations for the same environment variable replace earlier ones.

Redaction

Resolved secret values are exact-match redacted from tool results before they are stored in the session history or sent back to the model. They are also redacted from outbound user and tool messages as a final guard.

Summary

Functions

Returns an empty secrets container.

Returns resolved environment variables as {name, value} tuples.

Merges trusted environment overrides with session secrets.

Returns resolved secret environment variable names without values.

Redacts resolved secret values from outbound messages.

Redacts resolved secret values from a tool result before it is stored.

Redacts resolved secret values from a binary.

Returns a redactor spec for the resolved secrets.

Resolves a user-supplied secret declaration into a secrets container.

Functions

empty()

Returns an empty secrets container.

env(arg1)

Returns resolved environment variables as {name, value} tuples.

merge_env(secrets, overrides \\ [])

Merges trusted environment overrides with session secrets.

Session secrets win when the same variable is present in both places.

names(secrets)

Returns resolved secret environment variable names without values.

redact_messages(secrets, messages)

Redacts resolved secret values from outbound messages.

redact_result(secrets, result)

Redacts resolved secret values from a tool result before it is stored.

redact_text(secrets, text)

Redacts resolved secret values from a binary.

redactor(secrets)

Returns a redactor spec for the resolved secrets.

The returned spec can be composed with any other Condukt.Redactor spec. Returns nil when there are no resolved secrets.

resolve(secrets)

Resolves a user-supplied secret declaration into a secrets container.