Skip to content

Python: Docs: Learn-site coverage for functional workflow API (PR #4238) #5471

@moonbox3

Description

@moonbox3

Summary

Track docs updates for the functional workflow API shipped in #4238 (closed #3537). Code, tests, and samples have landed; user-facing docs on the Learn site still need coverage so users can discover and adopt the new API alongside the existing graph-based WorkflowBuilder.

What shipped in #4238

  • @workflow decorator — write workflows as plain async functions using native Python control flow (if/else, loops, asyncio.gather) instead of executor classes, edges, and builder patterns
  • @step decorator — opt-in, saves results for HITL resume and crash recovery; plain functions work inside @workflow without it and simply re-execute on resume
  • RunContext — optional parameter, needed only for HITL (ctx.request_info()), custom events (ctx.add_event()), or state (ctx.get_state() / ctx.set_state())
  • Streaming — workflow.run(stream=True)
  • HITL — ctx.request_info() with replay semantics
  • .as_agent() — wraps a functional workflow as an agent-compatible object
  • Samples under python/samples/01-get-started/ (05_functional_workflow_with_agents.py, 06_functional_workflow_basics.py) and python/samples/03-workflows/functional/ (basic_pipeline, basic_streaming_pipeline, parallel_pipeline, hitl_review, steps_and_checkpointing, agent_integration, naive_group_chat)

Docs work to do

  • Add a Learn-site page introducing the functional workflow API as a stepping stone between single-agent use and the graph API
  • Position functional vs. graph (WorkflowBuilder) API — when to pick which; both are supported
  • Document @workflow usage, signatures with and without RunContext, and return/output semantics
  • Document @step — what it does (result caching for HITL resume / crash recovery), when to use it (expensive operations: agent calls, API requests), and what happens without it (re-execution on resume)
  • Document streaming (run(stream=True)) and event flow
  • Document HITL with ctx.request_info() including replay behavior
  • Document RunContext APIs: request_info, add_event, get_state / set_state
  • Document .as_agent() and its use cases
  • Link the new samples from the relevant Learn-site sections
  • Cross-link from the existing workflow docs so users land on whichever API fits their task

References

Metadata

Metadata

Assignees

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions