Skip to main content

REFERENCE

Developer Reference

Authentication, APIs, SDKs, Flow Agent processors and parameter resolution, in full.

Introduction

The Server-Sent Events endpoint is the interface through which a client opens a connection to the server's event stream and receives the messages and events the server sends. Those messages carry all sorts of things: what an agent or bot says, system events, end-user messages. Once the endpoint is called, the client holds the connection open and receives events from the server.

  1. Request​

    There are four kinds of request event:

    • Start or reset
    • Send a message
    • Upload a file
    • Attach a file and send a message

    The request flow​

  2. Response​

    The event types:

    Event Types​

    NameWhat it is
    asgard.run.initThe SSE service initialises
    asgard.message.startThe conversation begins, possibly with some initial text
    asgard.message.deltaThe content updates, character by character, for a typewriter effect
    asgard.message.completeThe conversation ends, with the full text and the template
    asgard.run.doneThe SSE service has finished
    asgard.run.errorAn error in the SSE service, which appears only when something goes wrong
    asgard.process.startA process begins
    asgard.process.completeA process finishes
    asgard.tool_call.startA tool call begins, which appears only when a toolset is in use
    asgard.tool_call.completeA tool call finishes, which appears only when a toolset is in use

    A run initialises before any message is sent. A message then begins, continues and finishes. During the continuing stage there can be many deltas until the message is complete, and idx tells you their order. Only once the message is complete does the run finish.

    An ordinary conversation​

    A conversation that uses a toolset​

    Fact Fields​

    The fields inside an event:

    NameWhat it is
    runInitWhat init returns
    runDoneWhat done returns
    runErrorWhat error returns
    messageStartThe start of the message. The message object supports:
    messageId, replyToCustomMessageId, text, payload, idx, template
    messageDeltaAn increment of the message. The message object supports:
    messageId, replyToCustomMessageId, text, payload, idx, template (omitted as null)
    idx identifies the position of this piece of the message; see the delta examples below.
    messageCompleteThe completion of the message. The message object supports:
    messageId, replyToCustomMessageId, text, payload, idx, template
    processStartA process begins
    processCompleteA process finishes
    toolCallStartA tool call begins, which appears only when a toolset is in use
    toolCallCompleteA tool call finishes, which appears only when a toolset is in use

Ready to get started?

Want to see how Asgard fits your team? Talk to us.

Contact us