Dayward AIWeChat Mini Program
Multi-Agent Systems and the A2A Protocol in 7 Days: From In-Process Orchestration to Cross-Team Collaboration
Week 1 · D4🔒 LockedAbout 4 hours

Task Lifecycle: Long-Running Work, Streaming, Multi-Turn Input, and Cancellation

Another team's agent will not answer instantly. Today you give tasks a state machine and an event log: stream progress back chunk by chunk, resubscribe after a dropped connection without losing or repeating anything, pause to ask for missing information and carry on once it arrives, and cancel when the user no longer wants the result. Along the way you fix a bug that almost never shows up on a local machine: an SSE chunk boundary that falls in the middle of a multi-byte character.

Today's goals 0/3

Sign in to tick these off and save your progress.

Today's Goals

  1. Can draw the A2A task state machine, separate terminal states from interrupted states, and say what each of sending a message, subscribing, and canceling should return for a task that has already reached a terminal state
  2. Can implement streaming and resubscription, and prove with a controlled experiment that the events received after resubscribing match the uninterrupted run one for one
  3. Can implement multi-turn input and cancellation, explain what contextId and taskId each mean, and explain why cancellation is never guaranteed to succeed

Yesterday every task completed synchronously. Today tasks slow down like real work, and you handle every problem that only shows up once they do. When you finish, come back to the top and check off the three goals.

Plain-Language Walkthrough

A food delivery order page

After you order food, you do not stare at the pay button until it arrives. The order page tells you: the restaurant accepted, it is cooking, the courier picked it up, it is on the way, delivered. Occasionally it asks: "The dish you picked is sold out; swap it or refund?" The order waits there until you answer. If you change your mind there is a cancel button, but it is not guaranteed to work: once the food is cooked, you cannot cancel.

There is a detail you may never have noticed. Lose signal in the subway for ten minutes, reopen the page when you come up, and you see the current state. It does not replay from "accepted," and it does not skip "courier picked it up."

That order page is what A2A tasks get today: a state machine (where the order is), event delivery (you are told about every step), reconnection (you come back to an accurate current state), mid-way questions (it asks when something is sold out), and cancellation (not guaranteed).

Sign in and link WeChat to read

Sign in, then link your WeChat mini program account on the account page. Linked accounts share one free article per day. Unlock additional articles with rewarded videos in the mini program.

Mini program QR code

Scan in WeChat to open Dayward AI. Open the same course and chapter, choose the rewarded video, then refresh this page after completion.

Interview questions

  • A streaming subscription drops mid-way. After reconnecting, how do you guarantee that no event is lost or repeated?流式订阅中途断线,重连之后怎么保证事件不丢也不重?
    Common in ChinaCommon overseasDeep dive#a2a#streaming#reliability

    🔒 Unlock this chapter to see the answer keys.

  • What is the difference between the input-required and auth-required interrupted states? What should a client do in each?追问中与待授权这两种中断状态有什么区别?客户端分别该做什么?
    Common in ChinaCommon overseasIntermediate#a2a#task-lifecycle#authorization

    🔒 Unlock this chapter to see the answer keys.

  • Why is cancellation not guaranteed to succeed? How should a client handle a failed cancellation?取消为什么不保证成功?客户端该怎么处理取消失败?
    Common in ChinaCommon overseasIntermediate#a2a#cancellation#distributed-systems

    🔒 Unlock this chapter to see the answer keys.

  • Polling, streaming, and push notifications: which scenario suits each?轮询、流式、推送三种更新方式各适合什么场景?
    Common in ChinaCommon overseasBasic#a2a#streaming#push-notifications

    🔒 Unlock this chapter to see the answer keys.

Comments