#persistent-text-streaming with @convex-dev/agent

12 messages · Page 1 of 1 (latest)

distant cedarBOT
#

Hi @cerulean dawn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Currently, there is no official documentation or example in the provided knowledge sources that describes a direct, out-of-the-box integration between @convex-dev/persistent-text-streaming and @convex-dev/agent. Both are independent Convex components designed for different but complementary purposes:

  • @convex-dev/agent provides an AI agent framework with chat history, vector search, tool calls, and workflow integration. It handles message storage and streaming via its own abstractions, and supports streaming text and storing the final result in messages. However, it does not explicitly mention using persistent-text-streaming for its message streaming or storage layer. AI Agent documentation
  • @convex-dev/persistent-text-streaming enables real-time text streaming to the browser while also efficiently persisting the streamed data in the database. It is typically used for AI chat applications to balance HTTP streaming and database persistence, allowing both real-time updates and durable storage. Persistent Text Streaming documentation

How Might You Connect Them?

While there is no direct integration described, you could architect a solution where:

  • The agent generates text (using @convex-dev/agent).
  • As the agent streams or produces output, you use the persistent-text-streaming component to stream this output to the client and persist it in the database.
  • You would need to manually coordinate the flow: when the agent produces a message, append it to a persistent-text-streaming stream (using its API), and ensure your client subscribes to updates via the persistent-text-streaming React hook.

This would require custom glue code, as there is no built-in bridge between the two components in the current documentation.

#

Summary

  • There is no documented, automatic integration between @convex-dev/agent and @convex-dev/persistent-text-streaming.
  • You can use both in the same project, but connecting them requires manual coordination in your backend logic.
  • For inspiration, review the usage examples for each component and consider how to route agent outputs into persistent streams for real-time, durable delivery to clients.

If you need more concrete examples or step-by-step guidance, you may want to check the example directories in each component’s GitHub repo or ask in the Convex community for best practices as this is a common pattern for advanced AI chat apps.

Persistent Text Streaming documentation
AI Agent documentation

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@cerulean dawn Kapa.ai is still learning and improving, please let me know how I did by reacting below.

cerulean dawn
#

@distant cedar please provide code examples

distant cedarBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

I'm sorry, but the knowledge sources do not contain any code examples or official documentation that directly demonstrate how to connect @convex-dev/persistent-text-streaming and @convex-dev/agent together in a single workflow. Both components have their own usage examples, but there is no provided example or pattern for integrating them.

If you need to use both, you would need to manually coordinate their APIs in your backend logic, but the exact code for this is not available in the current knowledge sources. If you need further guidance, you may want to consult the Convex community or keep an eye on future updates to the documentation.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@cerulean dawn Kapa.ai is still learning and improving, please let me know how I did by reacting below.

cerulean dawn
#

@distant cedar can you create some?

distant cedarBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

I'm sorry, but the knowledge sources do not contain any code examples or official documentation that demonstrate how to directly connect @convex-dev/persistent-text-streaming and @convex-dev/agent together. While both components have their own usage examples, there is no provided or described integration pattern or sample code that combines them in a single workflow.

If you need to use both, you would need to manually coordinate their APIs in your backend logic, but the exact code for this is not available in the current knowledge sources. For further guidance, you may want to consult the Convex community or monitor future updates to the documentation for examples of this integration.

If you would like to see the individual usage examples for each component, I can provide those from the documentation. Let me know if that would be helpful!

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@cerulean dawn Kapa.ai is still learning and improving, please let me know how I did by reacting below.