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, aname, adesignationand a list oftasks. A user sees only the personas assigned to them. - Task: has an
id, anameand adescription. 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. Itsactivity_idis 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
- List the user's personas and their tasks.
- The user picks one and types a question.
- Create a conversation with the persona id and task id, open its stream, then send the text.
- Show the persona's answer as it arrives on the stream. Keep
activity_idfor 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.