Skip to main content

Context Handling

Agent Actions builds prompt context differently depending on execution mode.

Mode Differences

ModeContext Structure
OnlineInput data under source namespace
BatchInput data at root level

Online Mode

{
"source": {
"page_content": "Document text...",
"url": "https://example.com"
},
"seed": { "exam_syllabus": {...} }
}
Analyze: {{ source.page_content }}

Batch Mode

{
"page_content": "Document text...",
"url": "https://example.com",
"seed": { "exam_syllabus": {...} }
}
Analyze: {{ page_content }}
warning

The same template can fail in different modes. {{ source.field }} works in online but fails in batch.

Mode-Agnostic Templates

{% if source is defined %}
Content: {{ source.page_content }}
{% else %}
Content: {{ page_content }}
{% endif %}

Context Variables

VariableDescriptionAvailable In
sourceInput record (wrapped)Online only
seedStatic seed dataBoth modes
{action_name}Previous action outputBoth modes
Root fieldsInput record fieldsBatch only

Context Scope

Control data visibility with context_scope:

actions:
- name: my_action
context_scope:
observe:
- seed.exam_syllabus
- prev_action.result
drop:
- source.sensitive_field

Best Practices

  1. Choose one mode per workflow - Don't switch modes mid-workflow
  2. Match template to mode - Use source.* for online, root fields for batch
  3. Use seed data for static content - Works identically in both modes
  4. Analyze schemas - Run agac schema -a my_workflow to check field dependencies

See Also