> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-agentix/configure-cortex-agentix/automations/context-data/use-context-data-in-a-playbook.md).

# Use context data in a playbook

Use context data to pass information between playbook tasks in Cortex AgentiX.

In Cortex AgentiX you can use context data (from an issue or case) in playbooks, and you can use playbook tasks to update context data. You can:

* Use the information stored in the issue context data as task inputs and outputs in a playbook.
  * To access data that is stored in the issue context data, use the keyword `issue`.

    Example 43.

    To access a the `status` value in the issue context data, use the following syntax:

    ```programlisting
    ${issue.status}
    ```
  * To access data that is stored in the parent case context data, use the keyword `parentIncidentContext`.

    Example 44.

    To access the `hostname` value in the case context data, use the following syntax:

    ```programlisting
    ${parentIncidentContext.hostname}
    ```
* Set a breakpoint in a playbook that reviews context data after a specific task.

  This is available when using the debugger. As context data may be updated during a playbook run, setting a breakpoint enables you to pause the playbook execution, review the context data, and take action if necessary. Breakpoints can be useful when designing and troubleshooting playbooks. For more information, see [Test your playbook](/cortex-agentix/configure-cortex-agentix/automations/playbooks/build-your-playbook/test-your-playbook.md).
* Add a task that writes playbook data to the case context.

  When you add data to the case context, you can use this data to run playbooks on any of the issues that are included in the case.

  To write playbook data to the case context, use the `setParentIncidentContext` script in a standard task. For more information, see [Add context data to a case](/cortex-agentix/configure-cortex-agentix/automations/context-data/add-context-data-to-a-case.md).

  <div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><h3>Caution</h3><p>Users with Trigger Playbook permissions on a given issue may still be able to modify the parent case via commands and scripts, even without full access to the case.</p></div>

For more information about playbooks, see [Playbooks overview](/cortex-agentix/configure-cortex-agentix/automations/playbooks/playbooks-overview.md).

**Context data in sub-playbooks**

By default, the context data for sub-playbooks is stored in a separate context key. Consider the following information:

* When a task in a main playbook accesses context data, it does not have direct access to sub-playbook data.
* When a task in a sub-playbook accesses context data, it does not have direct access to the main playbook data.
* If the sub-playbook has been configured to share globally, the sub-playbook context data is available to the main playbook and vice versa.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-agentix/configure-cortex-agentix/automations/context-data/use-context-data-in-a-playbook.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
