> ## Documentation Index
> Fetch the complete documentation index at: https://apie.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Runtime intelligence walkthrough

> Walkthrough - see the dashboard story generated from a production release session.

You want to know what a generated session story actually looks like for a real workflow. This walkthrough follows a release gate agent that reviews a production rollout, calls a risky pipeline tool, and produces a dashboard story with the evidence reviewers need.

When you finish, the session replay shows a summary, grouped timeline, action item, and guardrail recommendation tied back to the raw events.

## Scenario

A release gate agent checks whether a production deployment can proceed. It reads release metadata, evaluates the rollout, and attempts to execute a production pipeline. In Monitor mode, the action is observed and may be recommended for approval later. In Enforce mode, the same guardrail can block or pause the action before the callback runs.

## Step 1 - Capture the session

Use a session for the whole release review and instrument the risky tool with explicit action and resource metadata.

<CodeGroup>
  ```ts TypeScript theme={null}
  await apie.withSession(
    {
      kind: "pipeline",
      inputSummary: "Review payments-api production rollout",
    },
    async (session) => {
      await apie.withRun(
        {
          sessionId: session.id,
          inputSummary: "Release gate check",
        },
        async (run) => {
          await apie.withTool(
            {
              runId: run.id,
              tool: { name: "release.read_manifest", provider: "github" },
              action: { type: "read", name: "read_manifest" },
              resource: { type: "code_repository", environment: "production" },
            },
            async () => readReleaseManifest(),
          );

          await apie.withTool(
            {
              runId: run.id,
              tool: { name: "cicd.trigger_pipeline", provider: "cicd", riskLevel: "high" },
              action: { type: "execute", name: "trigger_pipeline" },
              resource: { type: "pipeline_run", environment: "production" },
            },
            async () => triggerProductionPipeline(),
          );
        },
      );
    },
  );

  await apie.flush();
  await apie.shutdown();
  ```

  ```python Python theme={null}
  def release_review(session):
      def run_release_gate(run):
          apie.with_tool(
              {
                  "runId": run.id,
                  "tool": {"name": "release.read_manifest", "provider": "github"},
                  "action": {"type": "read", "name": "read_manifest"},
                  "resource": {"type": "code_repository", "environment": "production"},
              },
              lambda: read_release_manifest(),
          )

          apie.with_tool(
              {
                  "runId": run.id,
                  "tool": {
                      "name": "cicd.trigger_pipeline",
                      "provider": "cicd",
                      "riskLevel": "high",
                  },
                  "action": {"type": "execute", "name": "trigger_pipeline"},
                  "resource": {"type": "pipeline_run", "environment": "production"},
              },
              lambda: trigger_production_pipeline(),
          )

      apie.with_run(
          {"sessionId": session.id, "inputSummary": "Release gate check"},
          run_release_gate,
      )

  apie.with_session(
      {
          "kind": "pipeline",
          "inputSummary": "Review payments-api production rollout",
      },
      release_review,
  )

  apie.flush()
  apie.shutdown()
  ```
</CodeGroup>

## Step 2 - Open the session replay

Open the session in the Apie dashboard. While generation runs, you may see **Story generation queued** or **Generating session story**. The deterministic timeline remains available during this window.

When the generated story is ready, the top of the session replay should read like an incident or release review:

| Story element | Example outcome                                                                           |
| ------------- | ----------------------------------------------------------------------------------------- |
| Summary       | "Release gate attempted production pipeline execution"                                    |
| Outcome       | `approval_required`, `blocked`, `succeeded`, or another observed outcome from the session |
| Risk          | High, because the session included production pipeline execution                          |
| Confidence    | Based on the event metadata and linked evidence ids                                       |

## Step 3 - Review the story timeline

The story timeline groups raw events into reviewer-friendly steps.

| Raw evidence                                        | User-facing story card                                                           |
| --------------------------------------------------- | -------------------------------------------------------------------------------- |
| Run started, release manifest read                  | "Release gate reviewed production rollout metadata"                              |
| Guardrail evaluated for `execute` on `pipeline_run` | "Production pipeline execution was evaluated"                                    |
| Approval requested or block recorded                | "Production action required a human decision" or "Production action was blocked" |
| Run/session completed                               | "Release gate completed with follow-up required"                                 |

Each card keeps the evidence ids behind it. If a card mentions a guardrail decision, approval, or receipt, the dashboard can show the related record so you can verify the interpretation against the raw timeline.

## Step 4 - Act on the recommendations

For this session, runtime intelligence can produce two useful follow-ups:

| Follow-up                | What it means                                                                                                             |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| Action item              | Require approval before `cicd.trigger_pipeline` executes against production                                               |
| Guardrail recommendation | Add a guardrail for `execute` actions on `pipeline_run` resources in production, with recommended mode `require_approval` |

Use the recommendation as a starting point. If the deployment should always require a human decision, enable the matching template or create a guardrail in Require approval mode. If the action should never run autonomously, use Block instead.

## What changed from raw events

Runtime intelligence did not change the session, approve the deploy, or create a guardrail. It made the existing evidence easier to review:

* The raw event timeline still shows every instrumented action.
* Guardrail decisions still decide whether runtime execution proceeds.
* The generated summary and timeline compress the session into the story a reviewer needs.
* Action items and guardrail recommendations point to concrete next steps, but you decide which policy to enable.

## Next steps

<CardGroup cols={2}>
  <Card title="Runtime intelligence" icon="sparkles" href="/observe/runtime-intelligence">
    Learn what the generated summary, timeline, actions, and recommendations mean.
  </Card>

  <Card title="Enforce guardrails" icon="shield" href="/guardrails/enforce-guardrails">
    Turn recommendations into blocking or approval-required runtime policy.
  </Card>
</CardGroup>
