xFlow
  • Overview
    • Introduction
    • Core Features
    • Architecture
      • High Level Architecture
      • Tech Stack
      • Deployment Flexibility
      • Performance and Scalability
      • Security Compliance
  • Getting Started
    • Installation
    • Quick Start
    • Configuration
  • Core Concepts
    • Serverless Workflow Specification
    • Workflow data handling
    • Workflow Expressions
    • Error handling
    • Input and Output schema definition
    • User Task
    • User Forms
      • Lowcode Form
      • Advanced User Form
    • AI Agents in Enterprise Business Processes
    • Comparisons
      • BPMN2
  • Developer Guide
    • Architecture
    • API Reference
    • Workflow States Reference
      • Event State
      • Operation State
      • Switch State
      • Parallel State
      • Inject State
      • ForEach State
      • Callback State
      • UserTask State
      • AIAgent State
      • AIAgentProxy State
      • UserProxyAgent State
      • AI Outbound Agent State
    • Workflow Functions
      • REST
      • GraphQL
      • Custom
        • Built-in Functions
        • Lowcoder Query Function
      • Function Auth
    • Workflow Secrets
    • Integrations
    • Workflow Modeler
    • Frontend Development
      • Forms
        • Lowcode Form
        • Advanced User Form
    • Serverless Workflow Development
      • Operation State
      • Switch State
      • Parallel State
      • ForEach State
      • Callback State
      • User Task State
    • AI Agent Development
      • AI Agent
        • Predefined LLM
        • LLM Configuration
        • Multi LLM Configuration
        • Chat Memory
        • Tools
        • Data Output
        • Agent Outcomes
      • AI Agent Proxy
        • AI Agents Integration
      • User Proxy Agent
      • xChatBot Integration
  • Examples
    • Basic Examples
    • Advanced Examples
      • Loan Approval Workflow
      • QMS AP Workflow
  • Administration
    • Monitoring and Logging
    • Security
    • Performance Tuning
  • Extensions and Customizations
    • Plugins and Add-ons
  • Troubleshooting
    • Common Issues
    • FAQs
  • Release Notes
    • Version History
    • Upcoming Features
  • Support
    • Contact Information
    • Community
Powered by GitBook
On this page
  • Agent Outcome Properties
  • Purpose of Agent Outcomes
  • Usage Example
  1. Developer Guide
  2. AI Agent Development
  3. AI Agent

Agent Outcomes

PreviousData OutputNextAI Agent Proxy

Last updated 11 months ago

In xFlow, the AI Agent State leverages Agent Outcomes to define the actions that should be taken based on the results produced by the AI agent. This documentation explains the properties of Agent Outcomes, their purpose, and how they can be configured to ensure that the workflow transitions correctly based on the AI agent's output.

Agent Outcome Properties

Agent Outcomes are critical for defining the behavior of the AI agent within a workflow. They specify conditions, actions, and transitions that should occur based on the AI agent's responses. Below are the key properties of Agent Outcomes, along with examples for each.

Condition

  • Name: condition

  • Type: string

  • Description: An expression that must evaluate to true for this outcome to be matched. If the condition evaluates to false, the outcome is disregarded. The condition is typically used to check the AI agent's output or any relevant workflow data. These expressions follow the .

  • Example:

    condition: '${ $agentOutcome.returnValues.response != null }'

Finish

  • Name: finish

  • Type: boolean

  • Default: false

  • Description: If set to true, the agent will finish after this action is executed. If set to false, the agent will continue to process other actions or outcomes. This property is used to control whether the workflow should proceed further with the AI agent's execution.

  • Example:

    finish: true

Data Filter

  • Name: dataFilter

  • Type: object

  • Example:

    dataFilter: 
      useData: true
      dataOutputPath: '${ .response }'

Transition

  • Name: transition

  • Type: object

  • Description: Defines the outgoing transition when the outcome is selected. If not defined, the default transition will be used. The transition specifies the next state to move to in the workflow.

  • Example:

    transition: 
      nextState: "SuccessState"

Purpose of Agent Outcomes

Agent Outcomes serve several important purposes in the context of AI agents within xFlow:

  1. Conditional Execution: By defining conditions, workflows can execute specific actions only when certain criteria are met. This allows for more dynamic and responsive workflows that can adapt to different AI agent outputs.

  2. Workflow Control: The finish property allows for precise control over the workflow's execution flow, determining whether the AI agent should continue processing or terminate after a certain outcome.

  3. Data Management: The dataFilter property ensures that only relevant data is passed to subsequent states, reducing unnecessary data processing and improving workflow efficiency.

  4. State Transitions: The transition property clearly defines the next steps in the workflow, ensuring smooth and logical progression based on the AI agent's outcomes.

Usage Example

Here is an example of how to configure Agent Outcomes in an AI Agent State within a xFlow workflow:

- name: ExampleAIState
  type: aiagent
  agentName: ExampleAgent
  aiModel: gpt-4o
  systemMessage: "You are an assistant designed to provide accurate answers."
  userMessage: '${ "User: " + .request.question }'
  output: 
    schema: 
      type: "object"
      properties: 
        response: 
          type: "string"
          description: "The AI's response to the user question"
      required: ["response"]
  maxToolExecutions: 5
  memory: 
    memoryId: "session123"
    memoryType: "message_window"
    maxMessages: 10
  tools:
    - name: SEARCH_DOCUMENTS
      description: "Search for relevant documents based on the user's query."
      parameters: 
        schema: 
          type: "object"
          properties: 
            query: 
              type: "string"
              description: "The search query"
          required: ["query"]
      output: 
        schema: 
          type: "object"
          properties: 
            documents: 
              type: "array"
              items: 
                type: "string"
                format: "uri"
          required: ["documents"]
      execution:
        actionMode: "sequential"
        actions:
          - name: "FetchDocuments"
            functionRef:
              refName: "FetchDocumentsFunction"
              arguments:
                query: "${ .request.query }"
  agentOutcomes:
    - condition: '${ $agentOutcome.returnValues.response != null }'
      finish: false
      transition: 
        nextState: "SuccessState"
    - condition: '${ $agentOutcome.returnValues.response == null }'
      finish: true
      transition: 
        nextState: "ErrorState"

Description: Defines the data filter to be applied to the event data. Data filters are used to control which parts of the data should be passed along to subsequent workflow states. More details can be found in the .

For more detailed information and advanced configurations, refer to the .

Serverless Workflow Specification for Workflow Expressions
Event Data Filter Specification
AI Agent Development Documentation