agent_context
Return conditional behavior from an Agent's current active definition. Call it only for context
advertised by bootstrap and only when the component's load_when guidance
applies.
Parameters
{
"agent": "engineering/code-reviewer",
"component_keys": ["architecture"]
}
| Field | Type | Description |
|---|---|---|
agent | string | Exact caller-relative Agent name returned by the selected bootstrap result. |
component_keys | string[] | One to twenty advertised conditional-context keys to load. |
The response returns the requested conditional components in the agent definition's order. Use
the caller-relative name from the same task's selected bootstrap result. A later Agent behavior update
is visible here immediately because each call resolves the current active version. If a rename or
update invalidates the address or a requested key, bootstrap again before retrying.
Response
| Field | Type | Description |
|---|---|---|
agent | object | Identity of the current Agent version used for this response. |
agent.name | string | Canonical owner-qualified Agent display name. |
agent.version | integer | Active immutable version read for this call. |
components | object[] | All requested conditional components in canonical definition order. |
components[].key | string | Stable component key. |
components[].load_when | string | Guidance describing when this conditional behavior applies. |
components[].instructions | string | Instructions for the conditional behavior. |
Example
{
"agent": "engineering/code-reviewer",
"component_keys": ["architecture"]
}
Result:
{
"agent": {
"name": "engineering/code-reviewer",
"version": 7
},
"components": [
{
"key": "architecture",
"category_key": "quality",
"category_name": "Quality",
"name": "Architecture guidance",
"description": "Guidelines for architectural decisions.",
"load_when": "The task involves architecture or subsystem boundaries.",
"instructions": "Prefer the established subsystem boundary."
}
]
}
components contains all and only the requested conditional components, in the definition's
canonical order rather than the order of component_keys. Always-on components are already
included by bootstrap and cannot be requested here.
Errors
| Error | Cause |
|---|---|
invalid_params | Input has a missing, non-string, or empty Agent name; invalid keys; unknown fields; an empty/duplicate key list; or more than 20 keys. |
capability_denied | The credential lacks Agents. |
agent_context_unavailable | After capability checks, the qualified Agent name is malformed, missing, or hidden, or requested conditional context is unavailable. |
method_not_found | The tool is absent or deprecated. |
internal_error | An unexpected server error occurred. |
agent_context_unavailable does not reveal whether the Agent or a requested key is unavailable. The
same error is returned for an always-on key. It is an isError tool result,
returns no partial result, and does not guess a replacement name or key. Continue without that
context or bootstrap again.
Notes
agent_contextis an authenticated system tool and does not require Tools or a tool-policy entry. Returning Agent content requires Agents and current Agent visibility.- Always-on behavior is already included in
bootstrap; request only conditional context here. - The server rechecks the current credential's visibility and resolves the active version for every call. It does not keep task/session state.
- If a rename or behavior update makes the requested context unavailable, continue without that conditional context or call bootstrap again before retrying.