For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Logo
DeveloperAcademyCommunityStatus
ReferenceGuides
ReferenceGuides
  • Agent Studio
    • Overview
    • Quickstart Guides
    • Core Concepts
    • Conversation Process
    • Actions
    • Connectors
    • System Triggers
    • Agent Architect
      • DSL And Mapper Playground
      • Common DSL & Mapper Patterns
      • DSL
        • Full Mapper Reference
        • Mapping 2d Arrays To Lists Of Json
        • Examples Parsing A Streamed Response
        • Examples Sending An XML Request
    • Cookbooks
    • Development and Testing
    • AI Agent Marketplace
    • Developer Tools
  • Agentic AI
    • LLM Fundamentals
    • The Agentic Reasoning Engine
    • Memory Constructs
    • Conversational Context
    • Guardrails
    • Grounding and Hallucinations
    • Continuous Learning
    • LLMs & SLMs
    • Steerability Tools
    • Multilingual Support
  • Core Platform
    • User Identity
    • Moveworks Agent (On-Prem)
    • Approvals Engine
    • Entity Catalog
    • Moveworks Data Objects
    • Security Information and Event Management (SIEM) Logs Overview
DeveloperAcademyCommunityStatus
Agent StudioConfiguration LanguagesMapper

Examples: Parsing a Streamed Response

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Examples: Sending an XML Request

Next
Built with

Scenario: You receive streamed (SSE-style) responses from an action and want to parse it into objects.

An HTTP action returns a streamed response in this format:

data: {"thread_id": "d7b653f6-076a-4dfe-ae1f-cba4c442jd34", "date": "2025-11-11T20:37:49.053856Z"}
data: {"chunk": "echo bravo papa juliet oscar echo kilo mike kilo. (topic: hello from azure)"}
data: {"chunk": "charlie delta lima victor zulu whiskey delta uniform november. (topic: hello from azure)"}
data: {"chunk": "victor tango foxtrot india hotel tango papa xray alpha romeo. (topic: hello from azure)"}
data: {"chunk": "lima hotel oscar november uniform whiskey zulu india whiskey papa. (topic: hello from azure)"}

You want to produce:

  • thread_id from the first object
  • date from the first object
  • textas a concatenation of all chunk values

Approach

Treat the streamed output as a JSON array encoded as text:

  1. Remove the data: prefix
  2. Create JSON Strings
  3. Parse with $PARSE_JSON()
  4. Extract metadata from index [0] and chunks from [1:]

In your compound action the return can reference the SSE action

1- return:
2 output_mapper:
3 thread_id: $CONCAT("[", data.action_output.$REPLACE("data: ", ",").$TRIM(),"]"], "").$PARSE_JSON([0].thread_id
4 date: $CONCAT(["[", data.action_output.$REPLACE("data: ", ",").$TRIM(),"]"], "").$PARSE_JSON()[0].date
5 text:
6 EVAL():
7 expression: $CONCAT(x, " ")
8 args:
9 x:
10 MAP():
11 items: >
12 $CONCAT(
13 ["[", data.action_output.$REPLACE("data: ", ",").$TRIM()[1:], "]"],
14 ""
15 ).$PARSE_JSON()[1:]
16 converter: item.chunk

Or

1MERGE():
2 - data.action_output.$SPLIT("\n\n")[0].$REPLACE("^data: ", "").$PARSE_JSON()
3 - text: data.action_output.$TRIM().$SPLIT("\n\n").$MAP(x => x.$REPLACE("^data: ", "").$PARSE_JSON().chunk).$CONCAT("\n", true)