Skip to content

feat: support runtime system prompt interpolation in advanced agents - #1016

Merged
andreitava-uip merged 6 commits into
mainfrom
feat/advanced-system-prompt-interpolation
Aug 3, 2026
Merged

feat: support runtime system prompt interpolation in advanced agents#1016
andreitava-uip merged 6 commits into
mainfrom
feat/advanced-system-prompt-interpolation

Conversation

@andreitava-uip

@andreitava-uip andreitava-uip commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • accept callable system prompts in create_advanced_agent_graph and resolve them once from invocation inputs
  • carry the resolved prompt through dynamically declared graph state and prepend it to each Deep Agents model request
  • preserve the prepared Deep Agents prompt content blocks, prompt ordering, and cache metadata
  • avoid input-schema collisions by using uipath__system_prompt by default and selecting the first available deterministic suffix
  • bump uipath-langchain to 0.14.20

Verification

  • uv lock --check
  • Ruff format and lint
  • mypy on changed implementation and tests
  • targeted advanced-agent and workspace-memory tests (16 passed)
  • manual local validation

Copilot AI review requested due to automatic review settings July 31, 2026 07:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for runtime-interpolated system prompts in the advanced-agent wrapper graph by allowing system_prompt to be provided as a callable, resolving it once from invocation inputs, and injecting it into Deep Agents model requests via middleware while avoiding input-schema key collisions.

Changes:

  • Accept callable system_prompt in create_advanced_agent_graph, resolve it during transform_input, and carry it via a dynamically-extended graph state key.
  • Introduce _RuntimeSystemPromptMiddleware and _allocate_runtime_system_prompt_key to prepend runtime prompts to each model request and avoid schema/alias collisions deterministically.
  • Update tests to cover runtime prompt resolution, collision avoidance, request prepending behavior, and async middleware handling; bump package version to 0.14.20.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/uipath_langchain/agent/advanced/agent.py Adds runtime system-prompt middleware, state-key allocation logic, and callable system-prompt support in the advanced agent wrapper graph.
tests/agent/advanced/test_create_advanced_agent_graph.py Adds test coverage for callable system prompts, collision handling, middleware request prepending, and async paths.
pyproject.toml Bumps project version to 0.14.20.
uv.lock Updates locked package version to 0.14.20.

Comment thread src/uipath_langchain/agent/advanced/agent.py Outdated
@andreitava-uip
andreitava-uip enabled auto-merge (squash) July 31, 2026 09:44
@andreitava-uip andreitava-uip changed the title Support runtime system prompt interpolation in advanced agents feat: support runtime system prompt interpolation in advanced agents Jul 31, 2026
Comment thread src/uipath_langchain/_utils/_pydantic.py
Comment thread src/uipath_langchain/_utils/_pydantic.py
@andreitava-uip
andreitava-uip force-pushed the feat/advanced-system-prompt-interpolation branch from 6135fc2 to 70d971e Compare August 3, 2026 13:11
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@andreitava-uip
andreitava-uip merged commit ef7600c into main Aug 3, 2026
45 checks passed
@andreitava-uip
andreitava-uip deleted the feat/advanced-system-prompt-interpolation branch August 3, 2026 13:23
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.

3 participants