Skip to content

Secret binding declaration

A block says which credentials its code needs with @xratu_auth, by giving each one a key. The key is the block author's own name for the credential, such as api_key. It says nothing about which credential, which workspace or where it is stored: the project that uses the block decides that. This page covers the declaration, what bake records, and what happens when a new release changes what a key means.

The declaration

from sdk import xratu_auth

@xratu_auth(requires=["api_key"])
def generate(prompt: str) -> str:
    ...

Two different blocks can both call their key api_key and need completely different credentials. Xratu never connects credentials by key name: each project maps every use of a key itself. See Exact auth mapping and delivery.

A declaration on a class applies to each method the class exports.

What bake records

Bake records each declared key in the block's published manifest, tied to the exact function that declared it:

auth_requirements:
  - key: api_key
    requirement_id: arq_7f19...
    requirement_revision: 1
    reusable_capability_block_id: openai.generate
    interface_id: openai.generate
    interface_version: v1
    method: generate
    export_ordinal: 0

The manifest names the key and the function, never a binding, location or value, so the same published block works in any organization and any workspace.

Releases that change a key's meaning

When you publish a new release of a block, publish asks whether each key keeps means the same credential. If it does, projects using the block keep their mappings. If it comes to mean a different credential, requirement_revision goes up, and every project using the block must map that key again before it can be deployed.

Keys stay out of project documents

Project, workflow and agent documents name blocks. Which credential each key gets lives in the project's separate auth.xratu file, which the CLI writes for you.