Skip to content

feat: expose per-turn session metadata to the LLM - #9399

Merged
tomivirkki merged 6 commits into
mainfrom
feat/ai-orchestrator-context
Jun 1, 2026
Merged

tomivirkki merged 6 commits into
mainfrom
feat/ai-orchestrator-context

Conversation

@tomivirkki

@tomivirkki tomivirkki commented Jun 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The LLM needs ambient session context — current date/time, and optionally tenant, locale, or view state — to interpret relative references like "sales from the past two months" instead of guessing. Putting that in the system prompt would invalidate its cache every turn, so it rides on a built-in get_session_context tool whose description carries the content, keeping the (potentially large) system prompt cacheable.
  • The orchestrator installs a default supplier that provides the current server date and time; withMetadata lets apps replace or extend it with their own context, or pass null to disable the tool entirely.

Closes https://github.com/orgs/vaadin/projects/103/views/3?pane=issue&itemId=193058102

🤖 Generated with Claude Code

tomivirkki and others added 5 commits June 1, 2026 14:11
Without dynamic context, an LLM has no way to interpret relative
date/time references ("show me sales from the past two months") — it
guesses the date. The new AIOrchestrator.Builder#withContext accepts a
free-form supplier that the orchestrator invokes once per turn on the UI
thread; the resolved string is exposed to the LLM as the description of
a built-in get_session_context tool so it is available without a tool
call. The orchestrator installs a default supplier that renders the
current date/time; applications can compose richer context (tenant,
locale, page state) without touching the system prompt.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tomivirkki
tomivirkki requested a review from ugur-vaadin June 1, 2026 11:49
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tomivirkki
tomivirkki enabled auto-merge June 1, 2026 14:01
@tomivirkki
tomivirkki added this pull request to the merge queue Jun 1, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

Merged via the queue into main with commit 904d34e Jun 1, 2026
15 checks passed
@tomivirkki
tomivirkki deleted the feat/ai-orchestrator-context branch June 1, 2026 14:18
tomivirkki added a commit that referenced this pull request Jun 2, 2026
…9410)

This PR cherry-picks changes from the original PR #9399 to branch 25.2.
---
#### Original PR description
> ## Summary
> - The LLM needs ambient session context — current date/time, and
optionally tenant, locale, or view state — to interpret relative
references like "sales from the past two months" instead of guessing.
Putting that in the system prompt would invalidate its cache every turn,
so it rides on a built-in get_session_context tool whose description
carries the content, keeping the (potentially large) system prompt
cacheable.
> - The orchestrator installs a default supplier that provides the
current server date and time; withMetadata lets apps replace or extend
it with their own context, or pass null to disable the tool entirely.
> 
> Closes
https://github.com/orgs/vaadin/projects/103/views/3?pane=issue&itemId=193058102
> 
> 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.3.0.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants