Skip to main content

Core concepts

Your app works with four objects: personas, their tasks, conversations (called activities in the API) and runs. This is how they fit together.

Persona an AI assistant with a role "HR Assistant"
└─ Task one job the persona can do "Answer leave questions"
└─ Activity one conversation on that task "A user asking about carry-over"
└─ Messages what the user and the persona said
└─ Files what the user uploaded and what the persona produced
  • Persona: has an id, a name, a designation and a list of tasks. A user sees only the personas assigned to them.
  • Task: has an id, a name and a description. You always run a task of a persona, so you need both ids.
  • Activity: one conversation. These docs say "conversation"; the API paths and fields say activity. They are the same thing. It is created when a conversation starts. Its activity_id is what you use to send follow-up messages, read history and reach files.
  • Run: sending one message and waiting for the persona's answer. A run can use tools and take from a few seconds to several minutes.

The simplest possible app​

  1. List the user's personas and their tasks.
  2. The user picks one and types a question.
  3. Create a conversation with the persona id and task id, open its stream, then send the text.
  4. Show the persona's answer as it arrives on the stream. Keep activity_id for follow-ups.

Things that are true and easy to forget​

  • Runs use the user's usage allowance. Do not fire runs in loops or on page load.
  • Persona and task ids are different in every organisation.
  • The answer text is usually Markdown. Render it as Markdown.