A parent workflow coordinates other workflows as independently deployed services. A ticket responder can classify a ticket, call a knowledge-search workflow, and use the returned articles to draft a response. The child owns its containers, dependencies, scaling rules, retry configuration, and registry entry, so it can be updated without redeploying the parent. section 9.4.1
The integration boundary is platform.workflows.call(api_path, body). The method sends an HTTP POST through the gateway and returns a dictionary-like result, making a child workflow appear like any other platform service while preserving deployment isolation. section 9.4.1
Ticket responder and knowledge search
A parent classifies ticket_text with a chat model, then calls /knowledge/search with {"query": ticket_text, "category": category.content}. It receives the child result and continues building the customer response.
A production-oriented parent workflow relies on three operational behaviors:
- Treat sync, async, and streaming children through one call interface: return JSON for HTTP 200, poll a job for HTTP 202, or collect event-stream chunks. section 9.4.3
- Retry transient connection failures and 5xx responses with bounded attempts and exponential delay, while allowing 4xx request errors to fail immediately. section 9.4.3
Listing 9.15 Parent workflow calling a child workflow
@workflow(
name="ticket_responder",
api_path="/tickets/respond",
response_mode="sync",
timeout_seconds=30,
max_retries=3
)
def respond_to_ticket(ticket_text, customer_id):
platform = GenAIPlatform()
category = platform.models.chat( #A
model="gpt-4o-mini", #A
messages=[{"role": "user", #A
"content": f"Classify this" #A
f" ticket:" #A
f" {ticket_text}"}] #A
) #A
articles = platform.workflows.call( #B
"/knowledge/search", #B
{"query": ticket_text, #B
"category": category.content} #B
) #B
response = platform.models.chat(
model="gpt-4o",
messages=[{"role": "user",
"content": f"Draft a response"
f" to: {ticket_text}\n"
f"Articles:"
f" {articles['results']}"}] #C
)
return {
"response": response.content,
"category": category.content,
"sources": articles["sources"]
}Shows a complete parent workflow that classifies a ticket, invokes a knowledge-search child, and continues with the child result. section 9.4.1
Listing 9.18 Routing a workflow call based on the child’s response mode
def call(self, api_path, body):
response = self._http_post( #A
api_path, body
)
content_type = response.headers.get(
"content-type", ""
)
if response.status_code == 200: #B
if "text/event-stream" in content_type:
return self._consume_stream(
response
)
return response.json()
if response.status_code == 202: #C
job_id = response.json()["job_id"]
return self._poll_until_complete(
job_id
)
logger.error( #D
"child workflow %s returned %s: %s", #D
api_path, response.status_code, #D
response.text #D
) #D
raise WorkflowCallError( #D
f"Child workflow {api_path} failed"
f" with status {response.status_code}"
)Shows how the call interface routes synchronous, asynchronous, and streaming child responses. section 9.4.3
