Skip to content

AI-60: Add summary_fn parameter to TemporalModel for dynamic activity summaries#1451

Merged
xumaple merged 6 commits into
mainfrom
maplexu/AI-60-dynamic-summaries
Apr 22, 2026
Merged

AI-60: Add summary_fn parameter to TemporalModel for dynamic activity summaries#1451
xumaple merged 6 commits into
mainfrom
maplexu/AI-60-dynamic-summaries

Conversation

@xumaple
Copy link
Copy Markdown
Contributor

@xumaple xumaple commented Apr 15, 2026

Summary

  • Add summary_fn keyword-only parameter to TemporalModel for dynamic per-call activity summaries
  • summary_fn receives the LlmRequest and returns a summary string (or None)
  • When neither summary_fn nor static summary is set, falls back to reading adk_agent_name from LlmRequest.config.labels for zero-config agent name display
  • Setting both summary (in ActivityConfig) and summary_fn raises ValueError

Test plan

  • test_summary_fn_produces_dynamic_summary — integration test verifying dynamic summary in workflow history
  • test_summary_fn_returning_none — summary_fn returning None produces no summary
  • test_summary_fn_empty_string — empty string is a valid summary
  • test_adk_agent_name_label_fallback — integration test verifying zero-config label fallback
  • test_summary_and_summary_fn_raises — ValueError when both summary and summary_fn set
  • Full existing test suite passes

🤖 Generated with Claude Code

@xumaple xumaple requested a review from a team as a code owner April 15, 2026 17:21
@xumaple xumaple marked this pull request as draft April 15, 2026 17:21
@xumaple xumaple force-pushed the maplexu/AI-60-dynamic-summaries branch from eaf06d6 to 01c9f22 Compare April 15, 2026 17:22
@xumaple xumaple marked this pull request as ready for review April 15, 2026 17:27
Comment thread temporalio/contrib/google_adk_agents/_model.py Outdated
nyghtowl added a commit to temporal-community/ice-cream-fleet-demo that referenced this pull request Apr 15, 2026
…d migration notes

- Alias DemoTemporalModel as TemporalModel in agents.py so demo code
  and docs show the clean upstream API name
- Fix race where cancelling an in-flight order shows both DELIVERED
  and CANCELLED: execute_customer_change now checks order status
  before cancelling — if already delivered, cancel is a no-op
- CLAUDE.md updated with SDK PR migration plan (temporalio/sdk-python#1451)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nyghtowl added a commit to temporal-community/ice-cream-fleet-demo that referenced this pull request Apr 16, 2026
#22)

* TemporalModel alias for demo, fix cancel-after-deliver race, CLAUDE.md migration notes

- Alias DemoTemporalModel as TemporalModel in agents.py so demo code
  and docs show the clean upstream API name
- Fix race where cancelling an in-flight order shows both DELIVERED
  and CANCELLED: execute_customer_change now checks order status
  before cancelling — if already delivered, cancel is a no-op
- CLAUDE.md updated with SDK PR migration plan (temporalio/sdk-python#1451)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Ziggy's narrative, smart ETA pre-filter, order batching, new screenshot

Narrative:
- README intro reframed as Ziggy's delivery system, not abstract demo
- Demo flow uses incident language ("Agent Goes Down", "Driver Loses
  Connection", "Customer Changes Mind")
- DEMO_GUIDE one-minute pitch: "Ziggy's built on Temporal because
  ice cream delivery can't afford lost state"
- Opening scenario: "Ziggy's Opens for Business"
- New screenshot (meltdown-new-look.png)

Fleet Agent ETA optimization:
- Fleet status now includes driver positions + capacity in summary
- Fleet Agent instruction: pre-filter to 1-3 closest drivers by
  coordinates, then call tool_get_route_info for only those
- Each Maps API call remains a separate Temporal activity (per-call
  durability preserved for demo story)
- Removed unused batch ETA code (tool_get_all_driver_etas)

Order batching:
- 4-second collection window after first order lets drivers
  accumulate 2-3 orders before starting pickup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@xumaple xumaple changed the title AI-60: Add AdkActivityConfig with summary_fn for dynamic activity summaries AI-60: Add summary_fn parameter to TemporalModel for dynamic activity summaries Apr 17, 2026
Copy link
Copy Markdown
Contributor Author

@xumaple xumaple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

Comment thread temporalio/contrib/google_adk_agents/_model.py Outdated
Comment thread temporalio/contrib/google_adk_agents/_model.py Outdated
xumaple and others added 4 commits April 17, 2026 16:17
…maries

Introduce AdkActivityConfig extending ActivityConfig with a summary_fn
field that accepts a callable for dynamic per-call summaries. When no
summary_fn or static summary is set, falls back to reading adk_agent_name
from LlmRequest labels for zero-config agent name display.

Setting both summary and summary_fn raises ValueError to prevent ambiguity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…est, label fallback test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop AdkActivityConfig in favor of a keyword-only summary_fn parameter
on TemporalModel. Zero type: ignore comments needed.

Auditor findings addressed:
- Label fallback test rewritten as integration test
- Exception propagation documented in summary_fn docstring
- Empty string summary test added

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nd docstring

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@xumaple xumaple force-pushed the maplexu/AI-60-dynamic-summaries branch from 5faef5f to f96fab4 Compare April 17, 2026 20:17
xumaple and others added 2 commits April 20, 2026 14:17
Run all 4 summary_fn variants (dynamic, None, empty, label fallback)
as sequential agent invocations within one workflow, reducing CI overhead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@xumaple xumaple merged commit 4b69cd4 into main Apr 22, 2026
29 of 31 checks passed
@xumaple xumaple deleted the maplexu/AI-60-dynamic-summaries branch April 22, 2026 16:55
nyghtowl added a commit to temporal-community/ice-cream-fleet-demo that referenced this pull request May 14, 2026
* Drop DemoTemporalModel shim, rename CLAUDE.md → AGENTS.md

- Replace DemoTemporalModel with upstream TemporalModel +
  AdkActivityConfig(summary_fn=_build_summary) now that
  temporalio/sdk-python#1451 has shipped (temporalio 1.24.0).
- Delete the DemoTemporalModel class and _strip_nulls (cosmetic) from
  _demo_model.py; keep _build_summary and helpers.
- Rename CLAUDE.md → AGENTS.md (cross-tool convention); keep CLAUDE.md
  as a symlink so anything still reading the old path keeps working.
- Light edit: top-of-file note about the symlink and audience.

* Inline _build_summary into agents.py, drop _demo_model.py

The summary builder had one caller (the three agent factories below it) and
no reuse potential outside this file, so a separate module was over-fitting.
Folded the constants, helpers, and _build_summary into agents.py as a new
section between the activity-tool wrappers and the agent factories.
Updates the prose references in AGENTS.md and README.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants