Skip to main content

Messaging Protocol

Let's deep dive into the Sirji Messaging Protocol.

Overview

Custom agents in Sirji have their own custom pseudocode, which consists of a list of numbered steps. These steps provide a blueprint for how the conversation with the LLM will proceed. When a completions API call is made, the message history, along with the latest message, is passed to the LLM, which responds according to the Sirji Messaging Protocol, following the steps given in the pseudocode.

Initial Invocation

  • System Prompt and Invocation: At the beginning of a fresh session, when an agent is invoked, the system prompt and the invocation message are sent as input for the first completions API call.
  • LLM Response: The LLM responds with a message that aligns with the Sirji Messaging Protocol and the requirements of the agent pseudocode.

Pseudocode Execution

  • Pseudocode Structure: The pseudocode is a list of numbered steps that provide a blueprint for the conversation. Each step is converted into a message according to the Sirji messaging protocol by the LLM. The Sirji framework understands these messages, resulting in a limited number of allowed message types, restricting each pseudocode step to only permitted scenarios.
  • First API Call Response: In the response to the first completions API call, the LLM sends a message as per the first step of the pseudocode. For example, if the first step is "Read the problem statement from the Agent Output Folder," the LLM's response will instruct the Executor to read the file containing the problem statement.

Sequential Execution

  1. Executor Action: Upon receiving the LLM's response, the Executor reads the requested file.
  2. Second API Call: The Executor sends the file's content, along with the system message, the invocation message, and the message output from the first completions API call, in the second completions API call request.
  3. LLM Response to Step 2: In response to the second completions API call, the LLM responds with a message corresponding to step 2 of the pseudocode.

This process continues, with each step in the pseudocode being executed one by one.

Watch this YouTube video on the Sirji Messaging Protocol: