Skip to content

Linked Knowledge Base, Runtime, and Webapp#14

Open
JOrjales-gds wants to merge 19 commits into
ap/feature/agentcore_runtime_basefrom
feature-linked_kbruntime
Open

Linked Knowledge Base, Runtime, and Webapp#14
JOrjales-gds wants to merge 19 commits into
ap/feature/agentcore_runtime_basefrom
feature-linked_kbruntime

Conversation

@JOrjales-gds
Copy link
Copy Markdown
Contributor

Summary

Adds Knowledge Base integration to the AgentCore runtime and enables cross-stack wiring between AgentCore, KnowledgeBase, and WebApp constructs. The agent template now conditionally loads a KB retrieval tool when a Knowledge Base is attached, and the AgentCore stack exposes helpers (grant_invoke, environment_variables, runtime_role) that make it straightforward to compose these stacks together in a CDK app.

Changes

  • Knowledge Base retrieval in the agent template — the built-in agent conditionally imports the strands_tools.retrieve tool when KB_ID is present, appends a system prompt hint to use it, and adds strands-tools as a dependency.
  • Cross-stack integration on AgentCore — exposed runtime_role and runtime_arn attributes, with grant_invoke() method for granting InvokeAgentRuntime permission to other principals (e.g. a WebApp task role), and an environment_variables property that provides the runtime ARN for downstream containers.
  • Updated KnowledgeBase docstring — added an example showing how to wire a Knowledge Base to an AgentCore runtime.
  • Example: agent_with_kbase.py — standalone CDK app that deploys an AgentCore runtime backed by a Knowledge Base, ready for quick testing.
  • Example: webapp_with_agent/ — full end-to-end example with a Streamlit app that invokes the agent, a Dockerfile, devcontainer config, and a README covering both CDK deployment and local smoke testing via idea-app.

Testing

Follow the Readme file in examples/webapp_with_agent/. That walks through the process of creating firstly a linked agentcore runtime with a knowledge base present, but then also linking it back into a local webapp runnign streamlit, using the same structure as other apps (and compatible with smoke-test) such that it should run with other frameworks and as part of the CI/CD pipeline.

185 tests across all constructs, all pass

…edge base backing - read top docstring for guidance on how to deploy and test a tiny knowledge base via the agent
…ore runtime with KB and a local example streamlit app
… agent runtime within a webapp (simple payload via streamlit run locally)
… and updated knowledge base stack docstring to show how it interacts with agentcore and default agent code directory (if used as part of custom agent)
@JOrjales-gds JOrjales-gds requested a review from aakash-cddo May 19, 2026 14: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.

1 participant