diff --git a/agentex/openapi.yaml b/agentex/openapi.yaml index b8ab2b22..bcea9420 100644 --- a/agentex/openapi.yaml +++ b/agentex/openapi.yaml @@ -6605,6 +6605,18 @@ components: type: string title: Task Id description: ID of the task this message belongs to + agent_path: + anyOf: + - type: string + - items: + type: string + type: array + - type: 'null' + title: Agent Path + description: 'Identifier of the agent that emitted this message: a single + agent id, or a root-to-emitter path (e.g. ["researcher", "subagent-abc"]) + when nested agents share one task stream. Lets consumers attribute and + group streamed events by agent.' content: $ref: '#/components/schemas/TaskMessageContent' description: The content of the message. This content is not OpenAI compatible. diff --git a/agentex/src/api/schemas/task_messages.py b/agentex/src/api/schemas/task_messages.py index 50223c03..c564bb50 100644 --- a/agentex/src/api/schemas/task_messages.py +++ b/agentex/src/api/schemas/task_messages.py @@ -217,6 +217,15 @@ class TaskMessage(BaseModel): id: str | None = Field(None, description="The task message's unique id") task_id: str = Field(..., description="ID of the task this message belongs to") + agent_path: str | list[str] | None = Field( + None, + description=( + "Identifier of the agent that emitted this message: a single agent id, " + 'or a root-to-emitter path (e.g. ["researcher", "subagent-abc"]) when ' + "nested agents share one task stream. Lets consumers attribute and group " + "streamed events by agent." + ), + ) content: TaskMessageContent = Field( ..., description="The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.",