# Add AG-UI Streams to Existing Threads

> Add Intelligence’s AG-UI streams to your existing agent conversations, with optional historical import for supported stores.

<span id="what-is-this" />

## Add Intelligence to your existing app [#add-intelligence-to-your-existing-app]

Add reconnection, catch-up, and delivery across devices to the conversations your agent already manages. Follow the [Intelligence quickstart](/react-native/openai-agents-python/intelligence/quickstart) to connect your existing CopilotKit app and Runtime, then verify that a new conversation is saved. That setup enables AG-UI streams for runs through CopilotKit; importing old conversations is not required.

Your framework continues managing agent context and execution state. Keep your durable LangGraph checkpointer or ADK session service configured. Keep the mapping between CopilotKit `threadId` values and native conversation IDs stable. See [AG-UI Streams & Framework Threads](/react-native/openai-agents-python/intelligence/threads-explained#how-threads-work-with-framework-storage) for the responsibilities of each layer.

For a concrete example without historical import, see [keep an existing LangGraph conversation](/react-native/openai-agents-python/intelligence/bring-your-own-thread-system#example-keep-an-existing-langgraph-conversation).

## Include earlier conversations (optional) [#include-earlier-conversations-optional]

If you also want users to reopen history recorded before Intelligence was connected, copy supported history into Intelligence using the steps below. This guide covers Google ADK, LangGraph, Mastra, and AWS Strands stores. It copies historical content; it does not enable live delivery, recover past execution, or establish ongoing database replication.

Use Threads Drawer or `useThreads` to select a conversation, and pass its `threadId` to your chat. Imported and new conversations then use the same UI. Importing cannot recover content the source no longer exposes.

## Supported sources [#supported-sources]

| Source | Import guide | Supported history |
|---|---|---|
| Google ADK | [Add AG-UI streams to ADK sessions](/google-adk/threads-import) | Persisted ADK sessions from a database session service or Vertex/Agent Engine session service. |
| LangGraph | [Add AG-UI streams to LangGraph threads](/langgraph-python/threads-import) | Saved conversations from LangGraph Server / LangSmith deployments or Python FastAPI apps with durable persistence. |
| Mastra | [Add AG-UI streams to Mastra conversations](/mastra/threads-import) | Saved conversations from a local LibSQL database or a Mastra server. |
| AWS Strands | [Python](/strands/threads-import), [TypeScript](/strands-typescript/threads-import) | Saved single-agent conversations from local session files or S3; Python also supports AgentCore Memory native sessions. |

Open the guide for your source and follow it from start to finish. Each guide covers the target project, the dry run, the agent map, the destination, and the import command.

## What gets imported? [#what-gets-imported]

The importer preserves conversation content that can render in the CopilotKit chat UI or help downstream learning systems.

Always imported:

- User, assistant, tool, system, and developer messages
- Tool calls and tool results
- Original timestamps

Imported when the source has them:

- Reasoning traces
- Media that can be resolved during extraction
- Saved agent state

It does not import framework transport noise, LangSmith traces, or unsupported source stores. What is available depends on what your source saved; see your framework’s import guide for details.

## Import flow [#import-flow]

After you run the import in your source guide, check the result and keep your framework's persistence:

<Steps>
  <Step>
    ### Verify the imported conversations [#verify-the-imported-conversations]

    Sign in as the application user assigned to the imported conversation. Open it from the Threads Drawer and make sure that its history appears. Send a message and make sure that your native framework continues the same conversation.

    The importer also records import provenance and the outcome for each conversation.
  </Step>

  <Step>
    ### Continue using your framework's persistence [#continue-using-your-frameworks-persistence]

    Your app sends future conversations that run through CopilotKit to CopilotKit Intelligence. Keep your durable LangGraph or ADK persistence configured so those runs continue using both persistence layers. Reopen a conversation with the same CopilotKit `threadId` and a stable mapping to its native thread or session so its history stays continuous.

    Importing copies supported history; it does not establish ongoing database replication. Intelligence rename, archive, and delete operations affect only Intelligence records.

    - **Threads Drawer:** already included in CLI-created starters. Use the [Threads Drawer guide](/prebuilt-components/copilot-threads-drawer) to customize its ready-made thread UI.
    - **Headless Threads:** use the [Headless Threads guide](/headless-threads) only when you need a custom UI. Select a thread with `useThreads`, store its `thread.id`, and pass that value to your chat component as `threadId`.

    Use the imported `thread.id` returned by the Drawer or `useThreads` when you reopen the conversation. Keep any mapping to the native ID unchanged.

    For the underlying persistence and replay model, see [AG-UI Streams & Framework Threads](/react-native/openai-agents-python/intelligence/threads-explained).
  </Step>
</Steps>

## Deployment notes [#deployment-notes]

- **Cloud-hosted CopilotKit Intelligence:** export the destination values generated in the CLI-created app's `.env`, or pass them with `--api-url` and `--api-key`. `project select` can rewrite the app's generated values, but the importer still reads only flags or the current process environment. See [Cloud-hosted CopilotKit Intelligence](/react-native/openai-agents-python/intelligence/managed-intelligence-platform).
- **Self-hosted CopilotKit Intelligence:** pass the deployment's app-api URL with `--api-url` and a project-scoped `cpk` runtime key with `--api-key`. See [Self-host CopilotKit Intelligence](/react-native/openai-agents-python/intelligence/self-hosting).
