Skip to content

docs(samples): add memory-aware-agent sample - #1615

Open
mjnovice wants to merge 2 commits into
mainfrom
sample/memory-aware-agent
Open

docs(samples): add memory-aware-agent sample#1615
mjnovice wants to merge 2 commits into
mainfrom
sample/memory-aware-agent

Conversation

@mjnovice

@mjnovice mjnovice commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new sample at packages/uipath/samples/memory-aware-agent/ that demonstrates how to wire UiPath Agent Memory into a coded agent.

The sample:

  1. Searches a memory space via UiPath().memory.search_async
  2. Stitches the LLMOps-rendered system_prompt_injection into the system prompt
  3. Calls the LLM Gateway with the augmented context

Motivation: the Memory Spaces API landed recently (packages/uipath-platform/src/uipath/platform/memory/) but has no end-user sample. The SDK does not auto-wire memory based on the is_agent_memory_enabled flag in agent definitions — recall and prompt injection are explicit calls in agent code. The README spells that out so users do not look for magic that does not exist.

Files:

  • main.py — async main(input: AgentInput) -> AgentOutput, traced
  • pyproject.toml, uipath.json, bindings.json — match hello-world/llm_chat_agent conventions
  • README.md — prereqs, run instructions, data-flow diagram

Test plan

  • python -c "import ast; ast.parse(...)" — parses
  • uvx ruff check . — passes (samples are excluded from lint, but the code is clean)
  • uvx ruff format --check . — passes
  • Resolved real imports in the package's uv env: uipath.platform.UiPath, uipath.platform.memory.{MemorySearchRequest, SearchField, SearchSettings, SearchMode}, uipath.platform.chat.ChatModels, uipath.tracing.traced — all present
  • AgentInput / AgentOutput Pydantic models construct cleanly
  • End-to-end run: requires UIPATH_URL, UIPATH_ACCESS_TOKEN, UIPATH_FOLDER_KEY, and a real memory space — left for a reviewer with credentials

🤖 Generated with Claude Code

Demonstrates how a coded agent wires in UiPath Agent Memory: search a
memory space, stitch the LLMOps-rendered system_prompt_injection into the
LLM system prompt, then call the LLM Gateway. Includes a README clarifying
that the SDK does not auto-wire memory based on is_agent_memory_enabled
— recall and prompt injection are explicit calls in the agent code.

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

@RunnanJia RunnanJia left a comment

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.

LGTM

Copilot AI lite review requested due to automatic review settings August 11, 2026 16:47

Copilot AI left a comment

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.

Pull request overview

Adds a new packages/uipath/samples/memory-aware-agent/ sample that demonstrates explicit “Agent Memory” recall (Memory Spaces API) and prompt injection, then calls the LLM Gateway with the augmented system prompt.

Changes:

  • New async coded-agent sample that performs memory.search_async, stitches system_prompt_injection, and calls llm.chat_completions.
  • Adds sample scaffolding files (pyproject.toml, uipath.json, bindings.json) consistent with existing samples.
  • Adds a README describing prerequisites, how to run, and the end-to-end flow.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/uipath/samples/memory-aware-agent/uipath.json Declares the main function entrypoint for uipath run.
packages/uipath/samples/memory-aware-agent/README.md Documents prerequisites, setup, and the memory→prompt→LLM flow.
packages/uipath/samples/memory-aware-agent/pyproject.toml Sample project metadata and dependency on uipath.
packages/uipath/samples/memory-aware-agent/main.py Implements the traced async agent: memory recall + system prompt injection + LLM call.
packages/uipath/samples/memory-aware-agent/bindings.json Sample bindings stub (no resources).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +10 to +13
UIPATH_FOLDER_KEY Folder that owns the memory space (or pass folder_path)

The memory space itself is created out-of-band (UI, CLI, or
``uipath.memory.create``) and its id is passed in via ``AgentInput``.
Comment on lines +60 to +72
base_url = os.environ.get("UIPATH_URL")
access_token = os.environ.get("UIPATH_ACCESS_TOKEN")
folder_key = os.environ.get("UIPATH_FOLDER_KEY")

if not base_url or not access_token:
return AgentOutput(
response=(
"Missing required environment variables. "
"Set UIPATH_URL and UIPATH_ACCESS_TOKEN."
),
)

sdk = UiPath()
@sonarqubecloud

Copy link
Copy Markdown

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