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

# Architecture and flow

> How a conversation message becomes a durable run and final answer.

A conversation run starts with a stored user message.

Events stream while the runtime works, then the final result returns to the thread.

## Flow

| Step | What happens                                                            |
| ---- | ----------------------------------------------------------------------- |
| 1    | A user message is stored in the conversation.                           |
| 2    | A run starts to produce the assistant response.                         |
| 3    | Events record streaming output, tool calls, state, and terminal status. |
| 4    | The final answer is stored as an assistant message.                     |

```mermaid theme={null}
sequenceDiagram
  participant Client
  participant API as Veryfront API
  participant Store as Durable state
  participant Runtime as Agent runtime

  Client->>API: Create message
  API->>Store: Store user message
  Client->>API: Start run
  API->>Store: Create run and assistant placeholder
  API->>Runtime: Start execution
  Runtime->>API: Append run events
  API->>Store: Store events and status
  Client->>API: Attach to run stream
  API-->>Client: Replay and follow events
  API->>Store: Finalize assistant message
```

## What persists

| Object        | Stores                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------ |
| Conversation  | Thread metadata, project scope, active branch, and message count.                          |
| Message       | User prompts, assistant answers, tool output, files, citations, and typed parts.           |
| Run           | Execution identity, owner, status, lineage, and terminal state.                            |
| Agent run     | Conversation-specific execution state and assistant message link.                          |
| Run event     | Ordered execution history for streaming output, tool calls, state, errors, and completion. |
| Input request | Structured input needed while a run is waiting.                                            |

## Why events matter

Run events connect live execution to durable state.

They let the API stream, replay, resume, finalize, and explain a run.

See [AG-UI event reference](/cloud/conversation-api/streaming-events#ag-ui-event-reference) for event types.
