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

# Console

> An AI SRE session holds one complete conversation between you and the agent, including messages, streaming responses, tool calls, and artifacts. This page covers creating and managing sessions, sending messages, previewing artifacts, session forking, context compaction, team binding, and session data export.

<Info>
  **Private beta**: AI SRE is currently in private beta. Pro or higher accounts can apply for free beta access through the [AI SRE private beta application form](https://c9xudyniiq.feishu.cn/share/base/form/shrcn0ngCfdoygiaHnAT80BfZiH); after approval, Flashduty will add your account to the whitelist. Features and the UI may change during the beta.
</Info>

## Overview

***

A session is one complete conversation between you and AI SRE. It holds every message you send, the agent's streaming replies, tool calls made along the way, and any artifacts the agent produces (such as code, reports, charts, or Skill archives).

Each session is fully independent, with its own context, bound team, and environment. You switch between sessions in the left sidebar, and exchange messages, read replies, and view artifacts in the central chat area.

<Note>
  Sessions are isolated from one another: context, bound team, and environment do not affect each other. Switching sessions does not interrupt a turn that is already running — AI SRE keeps writing progress to the session, so when you return you can still see the streaming output.
</Note>

## Creating and Managing Sessions

***

The left sidebar is the single entry point for sessions. Click **New Chat** to start a fresh session. The list is sorted by most recent activity in descending order; only the most recent entries are shown initially, and older history is revealed incrementally with **Show more**.

### Search and Filter

<Steps>
  <Step title="Search chats">
    The search box at the top filters sessions by name. When there are no results, it displays **No matching chats found**.
  </Step>

  <Step title="Filter by scope / status / activity">
    Click the **Filter** icon in the upper-right corner of the list to open the filter panel and combine the dimensions below. When any non-default filter is active, a small dot appears on the filter button as a reminder.
  </Step>
</Steps>

Dimensions available in the filter panel:

| Dimension       | Options                           | Notes                                                                                          |
| --------------- | --------------------------------- | ---------------------------------------------------------------------------------------------- |
| Scope           | All / Personal / Team             | After selecting **Team**, you can search and multi-select specific teams from an inline list   |
| Status          | Active / Archived / All           | Defaults to showing only **Active** sessions; switch to **Archived** to view archived sessions |
| Recent activity | All / 24 hours / 7 days / 30 days | Narrows results by the session's most recent activity time                                     |

The panel footer provides **Reset** (restore default filters) and **Done** (close the panel).

### Per-Session Actions

Hover over a session row to reveal the pin and archive actions. A pinned session displays a persistent pin icon to the left of its name.

| Action              | Entry point                           | Notes                                                                                                           |
| ------------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Pin / Unpin         | Inline pin button on hover            | Pinned sessions appear at the top of the list                                                                   |
| Archive / Unarchive | Inline archive button on hover        | Archived sessions are hidden from the active list by default; switch to **Archived** in the filter to find them |
| Rename              | Click the chat title to edit in place | Press Enter or click away to confirm; press Esc to cancel; maximum 60 characters                                |

A new session does not need a manual title: after the first turn completes, the system auto-generates a title from the session's content (`POST /safari/session/generate-name`). Until that finishes, a placeholder title derived from your first message is shown so the sidebar never sticks at "Untitled." You can **rename** the session at any time to override the auto-generated title (title limit: 60 characters).

<Tip>
  Hovering over a session row for a moment shows a tooltip with the full session name, the associated team, and the exact timestamp — useful when the name is truncated and you need to confirm you have the right session.
</Tip>

### List Status Indicators

Each row shows one mutually exclusive indicator on the right:

| Indicator         | Meaning                                                                                                    |
| ----------------- | ---------------------------------------------------------------------------------------------------------- |
| Spinning circle   | The agent in this session is running (a turn is in progress)                                               |
| Blue dot (unread) | The agent has produced new content you have not yet viewed                                                 |
| Relative time     | When neither of the above applies, the relative time of the last activity is shown (e.g. `5m`, `3h`, `3d`) |

Opening a session clears its unread dot.

## Sending Messages and Streaming Responses

***

Type a message in the input box at the bottom and press Enter to send. The input box supports Markdown and slash commands (type `/` to open the command menu) to trigger built-in skills and commands.

### Attachments and Context References

<AccordionGroup>
  <Accordion title="Upload attachments" icon="paperclip">
    Click the paperclip button, or drag and drop / paste files directly. Supported formats include images, PDFs, and Office documents (Word / Excel / PowerPoint), up to **20 MB** per file. A single message can carry at most **9 attachments**; exceeding this shows "You can upload at most N files." Screenshots can be pasted directly into the chat.
  </Accordion>

  <Accordion title="Context references" icon="link">
    When you enter AI SRE from an incident, alert, monitor rule, or host page, the related object is embedded into the input box as a **reference capsule** — a small inline tag indicating the kind of object referenced — an incident, alert event, alert, monitor rule, or host — that travels with the message so the agent can start its analysis from that object directly. Click the capsule to open the referenced object in a new tab, or click its close button to remove the reference before sending. A single message can carry multiple references.
  </Accordion>

  <Accordion title="Knowledge and skills" icon="book">
    When a session starts, the knowledge packs and skills for the bound team are loaded automatically. See <a href="/en/ai-sre/knowledge">Knowledges</a> and <a href="/en/ai-sre/skills">Skills</a> for details.
  </Accordion>
</AccordionGroup>

### Real-Time Streaming Output

After you send a message, the agent's reply is streamed back in real time — text appears as it is generated, and tool calls and reasoning steps are rendered as they occur.

The moment you send, the frontend optimistically marks the turn as "running"; the backend's running status takes over after roughly 300 ms, so the running state is not lost even if you navigate away and return.

<Note>
  While a turn is running, **the Send button changes to a Stop button**. Clicking Stop immediately interrupts the current turn: the UI reflects this right away, and the interrupted turn is labeled "Interrupted" and remains visible after a page refresh.
</Note>

### Queueing Messages While Running

The input box remains active while a turn is running: you can keep typing and send messages, which are queued and executed in order after the current turn completes. Queued messages can be edited or removed before they are sent.

### Environment Initialization

The first time a session runs, an **environment initialization** card appears in the chat stream and steps through how the runtime environment (the sandbox) becomes ready: **set up a cloud container → start the runtime**. The two phases run serially, showing only the step currently in progress; once everything is done, the card collapses into a single result line that reflects whether this run created, resumed, or rebuilt the sandbox:

| Mode    | Collapsed label     | Meaning                                                                 |
| ------- | ------------------- | ----------------------------------------------------------------------- |
| Init    | Initialized session | A brand-new cloud container was created for the session                 |
| Resume  | Resumed session     | The previous sandbox was reused, with its files intact                  |
| Reclaim | Rebuilt session     | The previous sandbox had been reclaimed, so a new container was created |

<Warning>
  When the previous sandbox was reclaimed after being idle, the card warns: **Previous sandbox was reclaimed after N min idle — saved files were reset**. This means anything previously written to the sandbox filesystem is gone. Persist long-lived outputs by **saving them as an Artifact or to a Knowledge Pack**, rather than relying on transient sandbox files.
</Warning>

## Tool Calls and Artifacts

***

Tools the agent invokes during a turn (reading and writing files, querying monitors, executing commands, calling MCP tools, etc.) are rendered inline in the conversation as collapsible blocks. Click one to expand and inspect its inputs and outputs; they are collapsed by default to keep the chat readable.

### Artifacts Preview

Files the agent produces are available as artifacts with an inline preview. Click an artifact to open the preview panel on the right, which renders the content by type:

| Type                      | Preview                                                                                                                                  |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Code (multiple languages) | Syntax highlighting + line numbers                                                                                                       |
| Markdown                  | Rendered view by default; toggle to **Source**                                                                                           |
| HTML                      | Rendered view by default (iframe sandbox); toggle to **Source**                                                                          |
| Image                     | Displayed directly; a retryable error message is shown if loading fails                                                                  |
| PDF                       | Rendered in the browser's built-in PDF viewer                                                                                            |
| Skill archive (`.skill`)  | Left-side file tree + right-side content; the whole package can be downloaded, and you can **Save Skill** to your account with one click |

The preview panel provides **Copy**, **Download**, and **Close** actions.

<Tip>
  Report-type artifacts (such as operational insight reports) can be generated as HTML containing Mermaid diagrams and charts, viewable directly in the rendered view. For operational insight capabilities, see <a href="/en/ai-sre/insight">Operational Insight Reports</a>.
</Tip>

### Message Actions

Hover over a message to reveal action buttons:

| Action | Applies to                        | Notes                                                                                                                           |
| ------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Copy   | User message / artifact           | Copies the message or file content to the clipboard                                                                             |
| Retry  | User message                      | Restarts a turn using that message                                                                                              |
| Edit   | User message                      | Fills the message back into the input box for editing before resending                                                          |
| Fork   | Agent reply from a completed turn | Creates a new session from the completed turn that produced that reply, so you can continue down a different investigation path |

### Forking a session

After a turn has fully completed, a **Fork** button appears beside the agent reply. Click it to create a new session from the completed turn that produced that reply; AI SRE opens the new session automatically.

Forking is useful when you want to try another path from the same investigation context. The new session keeps the conversation, tool-call history, bound team, and bound environment up to the selected turn, but does not include later turns from the source session. The forked session includes a "Forked from conversation" divider; click it to return to the source position in the original session.

<Note>
  You can fork only from a **completed** turn in a top-level session. If the source session is still running, the selected turn has not settled, or the target is a Subagent child session, AI SRE rejects the fork.
</Note>

Forking clears temporary state that only belongs to an in-progress run, such as active-turn caches, pending mount state, frontend state that has not been persisted, and current-turn counters. Persisted history, tool calls, reusable compaction state, team binding, and environment binding are retained when they apply. The forked session has its own context, so later messages, compaction, and run results do not write back to the source session.

### Session Feedback

The chat header has a pair of session-level feedback buttons, **Helpful** / **Not helpful** (thumbs up / down), for rating the quality of the whole session.

Clicking **Not helpful** opens a feedback card where you can select preset reasons and add a note:

| Preset reason                | Meaning                                             |
| ---------------------------- | --------------------------------------------------- |
| Wrong diagnosis / root cause | The diagnosis or identified root cause is incorrect |
| Didn't find the root cause   | The real root cause was never located               |
| Remediation unavailable      | The suggested remediation cannot be applied         |
| Off-topic                    | The reply drifted away from your question           |

The card also has a free-text box to add specifics (optional). On submit, the feedback is persisted via `POST /safari/feedback/create`; when you reopen the session, the earlier rating is automatically refilled onto the header buttons.

## Context Compaction

***

As a conversation grows longer, the session context approaches the model's context-window limit. AI SRE automatically compacts older conversation history — summarizing it into a digest while preserving recent content — to free up context space without losing critical information.

Compaction is triggered in three ways:

| Trigger                   | Timing                                                                      |
| ------------------------- | --------------------------------------------------------------------------- |
| Automatic (before a turn) | Before a turn starts, when context usage exceeds the threshold              |
| Automatic (mid-turn)      | During a turn, if context continues to grow and crosses the threshold again |
| Manual                    | You explicitly trigger compaction with the `/compact` command               |

### What You Will See

* **Compaction in progress**: A status line reading "Compacting conversation context…" appears in the chat stream, showing elapsed time and progress; it disappears automatically when compaction finishes.
* **Compaction complete**: The conversation remains coherent with no action needed from you. The most direct indicator is the **Context** usage percentage in the chat header dropping — it reflects the current utilization of the context window, and hovering over it shows exact token usage.
* **No compaction needed**: When compaction is unnecessary (for example, the conversation history is too short, or it is already in a compacted state), a manual trigger returns an appropriate message such as "Context does not need compaction" or "Conversation history is too short to compact."

<Note>
  Compaction is transparent to you: what you perceive is a continuous conversation. The agent retains a summary of the compacted content in the background, so subsequent turns can still build on earlier key conclusions.
</Note>

## Binding a Team

***

When you create a session you can **bind a team** to it. Once bound, the session automatically loads that team's knowledge packs, skills, and MCP servers at startup, giving the agent the team's domain context and capabilities from the very beginning. When no team is bound, the session runs in account scope.

<Steps>
  <Step title="Select a team">
    Use the team selector in the new-session input area to choose the team to bind. Your last selection is remembered, so you do not have to repeat it each time.
  </Step>

  <Step title="Automatic team context loading">
    As soon as the session starts, the knowledge / skill / MCP metadata for "account scope + bound team" is loaded and the agent is ready to use.
  </Step>

  <Step title="On-demand cross-team knowledge mounting">
    When the agent needs knowledge from another team, it reads that team's knowledge directory on demand and mounts that team's knowledge and capabilities as persistent context in the current session — a mount remains active for the lifetime of the session.
  </Step>
</Steps>

The bound team stays with the session: reopening the same session restores the original team binding, and the session's team is also shown in the sidebar tooltip.

<Warning>
  Automatic linking between incidents / war rooms and teams is still evolving. You can currently bind a team to a session explicitly; automatic binding in incident scenarios will continue to improve in future updates.
</Warning>

For the rules governing team scope for resources (account scope vs. team scope, visibility, and edit permissions), see the "Scope" section on each resource page.

## Session entry kind

***

Every session is created with an **entry kind** (`entry_kind`) that identifies which surface produced it. The value is persisted to the database and returned in the create response.

| Value        | Source                                          | Notes                                                                                        |
| ------------ | ----------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `web`        | Console                                         | Default; unknown or missing values are automatically normalized to `web`                     |
| `im`         | IM platform (Feishu / DingTalk / WeCom / Slack) | Set automatically by the IM path; enables **in-place switching** for the session (see below) |
| `api`        | External API call                               | For programmatic integration scenarios                                                       |
| `automation` | Automated workflow                              | Sessions triggered by automation tasks                                                       |

When calling `POST /safari/session/create`, you may include `entry_kind` in the request body (optional; defaults to `web`). The `entry_kind` cannot be changed after the session is created.

<Note>
  Sessions with `entry_kind=im` support **in-place environment and team switching** — the IM `/env` and `/scope` commands can rebind the session to a different BYOC runner or team scope without discarding the conversation. Console sessions (`web`) have their environment and team fixed at creation time and do not support in-place switching.
</Note>

## Session data export

***

`POST /safari/session/export` streams all events from a session as **NDJSON** (`application/x-ndjson`), one JSON object per line. This is intended for auditing, archiving, offline analysis, or feeding session data into external systems.

### Request fields

| Field               | Type   | Required | Description                                                                                             |
| ------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- |
| `session_id`        | string | Yes      | ID of the session to export                                                                             |
| `include_subagents` | bool   | No       | When `true`, recursively includes the event streams of all subagent child sessions; defaults to `false` |

### Response format

The response `Content-Type` is `application/x-ndjson`. The **first line is always** a `session_meta` envelope containing the session's metadata; subsequent lines are session events. When `include_subagents=true`, each `subagent_dispatch` line is immediately followed by the complete event stream of the child session, which also begins with its own `session_meta` line.

```
{"type":"session_meta","session_id":"...","app_name":"..."}   // first line: session metadata
{"type":"message","..."}                                       // subsequent: event lines (type varies)
{"type":"subagent_dispatch","child_session_id":"..."}          // subagent dispatch marker
{"type":"session_meta","session_id":"<child>","..."}           // child session metadata
{"type":"message","..."}                                       // child session events
```

<Warning>
  If an error occurs after streaming has already begun, the server cannot switch to a standard JSON error envelope. Instead, a JSON-encoded error object is appended as the final line of the stream. Consumers must inspect this last line to determine whether the stream completed successfully.
</Warning>

**Permissions**: the export endpoint uses the same access gate as sending messages (`CanChatSession`), meaning the caller must have message-send permission on the session — read-only access is not sufficient.

## Related Pages

***

<CardGroup cols={2}>
  <Card title="Overview" icon="robot" href="/en/ai-sre/overview">
    Learn about AI SRE's positioning, capabilities, and use cases.
  </Card>

  <Card title="Usage Insights" icon="gauge-high" href="/en/ai-sre/insight">
    Generate team incident-handling and operational insights from session data.
  </Card>

  <Card title="Manage Knowledge" icon="book" href="/en/ai-sre/knowledge">
    Provide domain knowledge to sessions, loaded by team and mounted on demand across teams.
  </Card>

  <Card title="Skills" icon="wrench" href="/en/ai-sre/skills">
    Reusable skills invoked via slash commands.
  </Card>

  <Card title="MCP (External Tools)" icon="plug" href="/en/ai-sre/mcp">
    Connect external systems via MCP to extend the agent's tool capabilities.
  </Card>

  <Card title="IM Platform" icon="comment-dots" href="/en/ai-sre/im">
    Mention the agent in Slack / Feishu / DingTalk / WeCom to troubleshoot, with automatic war-room diagnosis.
  </Card>
</CardGroup>
