For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/concepts/context.md.

Execution context

ctx is the request-scoped object every step reads from. It holds the incoming request and the accumulated output of prior steps.

ctx
├── timestamp_epoch : int
├── request
│   ├── method  : string
│   ├── path    : map[string]string
│   ├── query   : map[string]string
│   ├── headers : map[string]string
│   └── body    : any
└── steps
    ├── <sql_step_name>
    │   ├── rows          : list(map)
    │   ├── row           : map (or null)
    │   └── rows_affected : int
    ├── <redis_step_name>
    │   └── value         : any
    ├── <starlark_step_name>
    │   └── result        : any
    └── <go_step_name>
        └── result        : any

Request

The request object is populated at ingress and remains immutable for the life of the request.

FieldTypeExample
ctx.request.methodstring"POST"
ctx.request.pathmap[string]stringctx.request.path.id
ctx.request.querymap[string]stringctx.request.query.page
ctx.request.headersmap[string]stringctx.request.headers.authorization
ctx.request.bodyanyctx.request.body.email

Path parameters are bound from route templates. Catch-all parameters such as {filepath...} bind the remaining path. Header keys are lowercased at ingress.

Steps

Step typeExported fieldsDescription
sqlrows, row, rows_affectedQuery results and affected-row count
redisvalueRetrieved cache value or command result
starlarkresultValue returned by execute(ctx)
goresultValue returned by the registered Go function

Access from HCL and Starlark

In HCL expressions, steps is available as a root-level shorthand for ctx.steps. In Starlark scripts, values are accessed beneath ctx using dictionary syntax.

ValueHCLStarlark
Path parameterctx.request.path.idctx.request.path["id"]
Query parameterctx.request.query.filterctx.request.query.get("filter")
Headerctx.request.headers.authorizationctx.request.headers.get("authorization")
Body fieldctx.request.body.namectx.request.body["name"]
SQL recordsteps.lookup.row.user_idctx.steps.lookup.get("row", {}).get("user_id")
SQL liststeps.list_users.rowsctx.steps.list_users["rows"]
Redis valuesteps.cache_lookup.valuectx.steps.cache_lookup.get("value")
Step resultsteps.compute.resultctx.steps.compute["result"]