Skip to content
Prompty

Executor

Calls an LLM provider with messages and returns the raw provider response.

---
title: Executor
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class Executor {
      <<protocol>>
        +execute(agent: Agent, messages: Message[]) unknown [async-capable]
        +executeStream(agent: Agent, messages: Message[]) unknown [async-capable, optional default]
        +formatToolMessages(rawResponse: unknown, toolCalls: ToolCall[], toolResults: string[], textContent: string?) Message[] [sync]
    }

The following helper methods are declared via @method and must be implemented by every runtime. The schema declares the logical protocol contract; each runtime maps async-capable methods to idiomatic sync/async shapes for that language.

Name Signature Runtime shape Description
execute execute(agent: Agent, messages: Message[]) -> unknown async-capable Call an LLM provider with messages and return the raw response
executeStream executeStream(agent: Agent, messages: Message[]) -> unknown async-capable, optional default Call an LLM provider and return a streaming response. Returns a language-specific async iterable/stream of raw chunks. Not all providers support streaming; the default implementation should signal lack of support.
formatToolMessages formatToolMessages(rawResponse: unknown, toolCalls: ToolCall[], toolResults: string[], textContent: string?) -> Message[] sync Format tool call results into messages for the next iteration