AIAgentProxy State

The AIAgentProxyState is used to define an AI Agent Proxy state within a serverless workflow. This state facilitates interaction with an AI agent, allowing for user messages, system prompts, and agent outcomes to be managed within a workflow.

AIAgentProxyState

The AIAgentProxyState is a specialized state in a serverless workflow designed to integrate AI agents developed by any AI framework. The state defines the agent's configuration, including the integration details, possible outcomes, and other properties.

Parameter

Description

Type

Required

agentName

The name of the agent.

string

yes

systemMessage

The system message used to construct the LLM prompt.

string

no

userMessage

The user message.

string

yes

memoryId

The memory ID to store the agent history. If not specified, the workflow process instance scope is used.

string

no

Define list of agent outcomes. Each outcome is described by the OnAgentOutcome schema.

array

yes

Agent proxy execution described by the AgentProxyExecution schema.

object

yes

Filter to apply to the state data.

string

no

OnAgentOutcome

The OnAgentOutcome object defines the actions to be performed based on the outcome of the AI agent. The actions are executed if the outcome matches the specified conditions.

Field

Description

Type

Required

condition

Expression, if defined, must evaluate to true for this outcome to be matched. If false, the outcome is disregarded.

string

no

finish

If true, the agent will finish after this action is executed. If false, the agent will continue to process.

boolean

no

Event data filter described by the EventDataFilter schema.

object

no

The outgoing transition when the outcome is selected, if not defined the default transition will be used.

object

no

AgentProxyExecution

The AgentProxyExecution object specifies how the AI Agent are to be invoked by the AI Agent Proxy. The function will be executed and provided with 3 arguments: workflowId, agentConfig, and agentContext. (See AI Agent Proxy Integration)

Field

Description

Type

Required

References a reusable function definition to be invoked

object

yes

Example:

YAML
states:
  - name: RagAgentProxy
    agentName: RagAgentProxy
    type: aiagentproxy
    systemMessage: You are a helpful assistant
    userMessage: '${ .request.question }'
    execution:
      functionRef:
        refName: "ExecuteRagAgentProxy"
    agentOutcomes:
    - condition: '${ true }'
      finish: true
      transition: InformRagAgentProxyResult
  - name: InformRagAgentProxyResult
    agentName: InformRagAgentProxyResult
    type: userproxyagent
    agentRole: relay
    userMessage: '${ .request.question }'
    relayMessage:
      text: ${ ._ai_agent_state.RagAgentProxy.agentOutcome.finish.output.message }
      mediaExp: ${ ._ai_agent_state.RagAgentProxy.agentOutcome.finish.output.images }
    output: |-
      {
          "type": "object",
          "properties": {
              "answer": {
                  "type": "string"
              }
          },
          "required": ["answer"]
      }
    agentOutcomes:
    - condition: '${ true }'
      finish: true
      transition: Finish
functions:
  - name: ExecuteRagAgentProxy
    type: custom
    operation: ExecuteQueryAction
    metadata:
      libraryQueryName: post.rag_agent_proxy
      libraryQueryRecordId: latest
      params: '["workflowId", "agentConfig", "agentContext"]'

This document provides a detailed view of the AIAgentProxyState state and its related objects, including comprehensive schema definitions, required fields, and descriptions for each attribute within the AIAgentProxyState and associated schemas. This specification ensures clarity and completeness for integrating AI agents within serverless workflows.

Last updated