AgentLabs - Docs
  • Introduction
    • What is AgentLabs?
    • Get Started with AgentLabs
    • Pricing
  • Getting Started
    • Installation
    • Secret Key
    • Using the SDK
  • Core Concepts
    • Frontend as a service
    • User Authentication
    • Project
    • Agents
    • Messages
      • Messages Format
      • One-off vs Stream
      • Typewriter animation
    • Attachments
  • Recipes
    • Before we start
    • Ping-Pong
    • ChatGPT with LangChain
    • Code Interpreter
    • Mutli-Agent with AutoGen
  • 🧙Community
    • Github
    • Discord
    • Support team
Powered by GitBook
On this page
  1. Core Concepts
  2. Messages

Typewriter animation

How animate your messages properly with Typewrite

PreviousOne-off vs StreamNextAttachments

Last updated 1 year ago

We explained in the previous section that you can use either the send method (for one-off messages) or the write method (for sending streams).

But sometimes, you want to send some one-off messages that look like streams.

Since v0.0.51 the Node and Python SDKs provide a typewrite() method that allows you to simulate a stream with a smooth animation, even if you know the content in advance.

How it works?

await agent.typewrite({
    conversationId: "conversationId",
    text: "Here's your message",
    intervalMs: 60, // optional
    initialDelayMs: 1500, // optional
});
agent.typewrite(
    conversationId="conversationId",
    text="Here's your message",
    interval_ms=60, # optional
    initial_delay_ms=1600 # optional
)

Behind the scenes, AgentLabs will instantiate a new stream and start sending the stream with a nice typewriter effect.

The full code of this video is .

available here
Showcasing typewriter animation using typewrite()