Skip to content

feat(task-messages): add optional agent_path to TaskMessage - #381

Open
vkalmathscale wants to merge 1 commit into
mainfrom
feat/task-message-agent-path
Open

feat(task-messages): add optional agent_path to TaskMessage#381
vkalmathscale wants to merge 1 commit into
mainfrom
feat/task-message-agent-path

Conversation

@vkalmathscale

@vkalmathscale vkalmathscale commented Jul 28, 2026

Copy link
Copy Markdown

What

Add an optional agent_path field to the TaskMessage API schema (agentex/src/api/schemas/task_messages.py) and regenerate openapi.yaml.

agent_path is str | list[str] | None: a single agent id, or a root-to-emitter path (for example, ["researcher", "subagent-abc"]) for nested agents that share one task stream.

Why

Streamed task-message events currently carry only a task_id, so when multiple agents emit into a single task stream their events cannot be attributed to the emitting agent. Stream events already reference the message via parent_task_message: TaskMessage, so TaskMessage is the correct OpenAPI surface to carry the source. Consumers can then group and filter streamed events by agent.

Scope

  • API schema plus regenerated openapi.yaml only.
  • Additive and backward-compatible (optional, defaults to null).
  • Stream-only: no TaskMessageEntity, storage, or migration change.

Paired SDK PR and merge order

This is the root of a two-PR change; the generated Python SDK consumes this spec:

  1. Merge this PR first. On merge, the automated Stainless flow uploads the spec and opens/commits codegen to scale-agentex-python next, adding agent_path to the generated TaskMessage.
  2. Then feat(streaming): tag streamed events with agent_path scale-agentex-python#474, the SDK-side runtime that stamps agent_path onto the in-memory envelope before emitting start/delta/full/done, is rebased to drop its temporary manual patch and rely on the regenerated field.

Verification

make gen-openapi regenerated the spec; the pre-commit "Regenerate AgentEx OpenAPI spec" hook passed (spec in sync), and ruff and ruff-format passed. Diff is the new field only (+21, no deletions).

Generated with Claude Code

Streamed task-message events carry only a task_id, so events emitted by
multiple agents into a single task stream cannot be attributed to their
source. Add an optional agent_path to the TaskMessage schema — a single
agent id, or a root-to-emitter path for nested agents sharing one stream.
Stream events already carry it via parent_task_message, so TaskMessage is
the right OpenAPI surface for per-agent attribution.

Additive and backward-compatible (optional, defaults to null); stream-only,
so no entity/storage change. Regenerated openapi.yaml via make gen-openapi.

The generated Python SDK (scale-agentex-python) picks this up via the
automated Stainless flow; the runtime that stamps agent_path lands in
scale-agentex-python#474.
@vkalmathscale
vkalmathscale requested a review from a team as a code owner July 28, 2026 18:45
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

✱ Stainless preview builds

This PR will update the agentex-sdk SDKs with the following commit messages.

openapi

feat(api): add agent_path field to TaskMessage

python

feat(api): add agent_path field to TaskMessage model

typescript

feat(api): add agent_path field to TaskMessage

Edit this comment to update them. They will appear in their respective SDK's changelogs.

agentex-sdk-typescript studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/agentex-sdk-typescript/9418fbafec7dd5659e9fdcde2dc9c63c9ca80174/dist.tar.gz
agentex-sdk-openapi studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅

agentex-sdk-python studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ✅lint ✅test ✅

pip install https://pkg.stainless.com/s/agentex-sdk-python/7c09bcd549cbec54f9d7349a7627513a21d5680a/agentex_client-0.20.0-py3-none-any.whl

This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-07-28 18:48:31 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant