Skip to content

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

Open
xumaple wants to merge 4 commits intomainfrom
maplexu/AI-60-dynamic-summaries
Open

AI-60: Add summary_fn parameter to TemporalModel for dynamic activity summaries#1451
xumaple wants to merge 4 commits intomainfrom
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
)
if activity_config:
self._activity_config.update(activity_config)
raw = dict(activity_config) if activity_config else {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems quite messy. And we don't really get anything out of the subclass here since we just have summary and summary_fn anyway

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

messy in terms of code cleanliness of how I'm handling this section, or this overall idea of subclassing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The handling. Raw dicts, type ignores, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I decided to remove the subclass altogether, because couldn't find a way to get the code much cleaner and reduce the errors. Let me know what you think now.

@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

the workflow task.

Raises:
ValueError: If both 'summary' and 'summary_fn' are set.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

summary doesn't make sense here. qualify with ActivityConfig::summary or equivalent

)
if activity_config:
self._activity_config.update(activity_config)
raw = dict(activity_config) if activity_config else {}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I decided to remove the subclass altogether, because couldn't find a way to get the code much cleaner and reduce the errors. Let me know what you think now.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants