[AI] AG-UI compliant Langgraph ReAct agent implementation#10612
[AI] AG-UI compliant Langgraph ReAct agent implementation#10612ananzh merged 5 commits intoopensearch-project:mainfrom
Conversation
❌ Empty Changelog SectionThe Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10612 +/- ##
=======================================
Coverage 60.14% 60.14%
=======================================
Files 4425 4425
Lines 118370 118370
Branches 19443 19443
=======================================
Hits 71188 71188
Misses 42267 42267
Partials 4915 4915
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "modelId": "us.anthropic.claude-sonnet-4-20250514-v1:0" | |||
There was a problem hiding this comment.
does it perform better using claude sonnet 4.5?
There was a problem hiding this comment.
will try it and share feedback
|
|
||
| // Check for custom system prompt file path from environment variable | ||
| let customSystemPrompt: string | undefined; | ||
| const systemPromptPath = process.env.SYSTEM_PROMPT; |
There was a problem hiding this comment.
can take up as fat-follow
| */ | ||
|
|
||
| import { StateGraph, START, END, Annotation } from '@langchain/langgraph'; | ||
| import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite'; |
There was a problem hiding this comment.
can this use https://langchain-ai.github.io/langgraphjs/agents/agents/?h=memory+saver#5-add-memory
import { StateGraph, START, END, Annotation, MemorySaver } from '@langchain/langgraph';and not introduce sqlite lib dependency?
| hasAwsAccessKey: !!process.env.AWS_ACCESS_KEY_ID, | ||
| hasAwsSecretKey: !!process.env.AWS_SECRET_ACCESS_KEY, | ||
| hasAwsProfile: !!process.env.AWS_PROFILE, | ||
| hasAwsSessionToken: !!process.env.AWS_SESSION_TOKEN, |
There was a problem hiding this comment.
these are unnecessary logs? sdk should figure out where credentials come from
| `; | ||
| prompt = prompt.replace('{{CLIENT_STATE}}', stateContent); | ||
| } else { | ||
| prompt = prompt.replace('{{CLIENT_STATE}}', '// No client state provided'); |
There was a problem hiding this comment.
what is {{CLIENT_STATE}}? can this placeholder come from some constant?
would clientState ever be a complex/circular object that can't be stringified?
| }`; | ||
|
|
||
| if (tool.inputSchema.required && tool.inputSchema.required.length > 0) { | ||
| toolDescription += `\n - Required parameters: ${tool.inputSchema.required.join(', ')}`; |
There was a problem hiding this comment.
the langgraph framework doesn't auto do this and requires us to manually build tool prompt?
There was a problem hiding this comment.
can check this and get back on it
Lint fixes and changing file to snake case Fixing imports for snake case feat: Implement TextMessageManager for improved message lifecycle management and tool call interruption in AG UI feat: Refactor tool result handling to improve message lifecycle management in BaseAGUIAdapter feat: Improve response handling by logging warnings for empty content blocks and filtering out empty text blocks to prevent ValidationException Renaming text_message_manager and imports Signed-off-by: Megha Goyal <goyamegh@amazon.com> Adding default observability prompt Signed-off-by: Megha Goyal <goyamegh@amazon.com> Removing jarvis and coact agents Signed-off-by: Megha Goyal <goyamegh@amazon.com>
Signed-off-by: Megha Goyal <goyamegh@amazon.com>
Signed-off-by: Megha Goyal <goyamegh@amazon.com>
Signed-off-by: Megha Goyal <goyamegh@amazon.com>
joshuali925
left a comment
There was a problem hiding this comment.
didn't get to go through everything, but approving since it's a separate experimental package
| "build": "tsc", | ||
| "clean": "find . -name '*.js' -not -path './node_modules/*' -delete", | ||
| "opensearch:ingest": "ts-node src/opensearch-ingestion.ts", | ||
| "opensearch:watch": "ts-node src/opensearch-ingestion.ts --watch" |
There was a problem hiding this comment.
file is opensearch_ingestion with underscore
|
Failed windows tests are known CI/CD issue that we observe in my PRs lately. There is a tracking fix #10613. Should not block PR due to these CI/CD issues. Wait for the last cypress to re-run then we could merge the PR in. |
…-project#10612) * AG-UI compliant Langgraph ReAct agent implementation Lint fixes and changing file to snake case Fixing imports for snake case feat: Implement TextMessageManager for improved message lifecycle management and tool call interruption in AG UI feat: Refactor tool result handling to improve message lifecycle management in BaseAGUIAdapter feat: Improve response handling by logging warnings for empty content blocks and filtering out empty text blocks to prevent ValidationException Renaming text_message_manager and imports Signed-off-by: Megha Goyal <goyamegh@amazon.com> Adding default observability prompt Signed-off-by: Megha Goyal <goyamegh@amazon.com> Removing jarvis and coact agents Signed-off-by: Megha Goyal <goyamegh@amazon.com> * Changeset file for PR opensearch-project#10612 created/updated * Fixing build failures due to langgraph-checkpoint-sqlite Signed-off-by: Megha Goyal <goyamegh@amazon.com> * Fixing yarn.lock using yarn v1.22.10 Signed-off-by: Megha Goyal <goyamegh@amazon.com> * Fix yarn.lock aain for 1.22.10 after rebase Signed-off-by: Megha Goyal <goyamegh@amazon.com> --------- Signed-off-by: Megha Goyal <goyamegh@amazon.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Signed-off-by: Nathan Yang <yanatha@amazon.com>
Description
This PR introduces the
osd-agentspackage - an experimental reference implementation of an AG-UI compliant ReAct (Reasoning and Acting) agent built with LangGraph and AWS Bedrock.What does this agent do?
The agent implements a reasoning loop that:
Key Features
Architecture Highlights
What's Included
src/agents/langgraph/)Experimental Status
Issues Resolved
RFC #10585
Can be used in conjunction with chat interface and client tools of context provider in #10600
Screenshot
TBD
Testing the changes
Tested with PR #10600
The agent can be tested via:
Changelog
Check List
yarn test:jestyarn test:jest_integration