LlamaIndex Memory Integration: Bedrock AgentCore
Installation
To install the required package, run:
%pip install llama-index-memory-bedrock-agentcore
Bedrock AgentCore Setup Pre-Requisites
- AWS account with Bedrock AgentCore access
- Configured AWS credentials (boto3)
- Created memory resource in AWS Bedrock AgentCore
- Required IAM permissions:
- bedrock-agentcore:CreateEvent
- bedrock-agentcore:ListEvents
- bedrock-agentcore:RetrieveMemories
Sample Usage
- Create an instance of AgentCoreMemoryContext to setup the memory resources that you will need for building an agent.
- Actor id → This is a required field and it is the identifier of the actor (could be an agent or the end-user).
- Memory id → This is a required field and it is the identifier of the memory store.
- Session id → This is a required field and it is the unique identifier of a particular conversation.
- Namespace → This is an optional field and it is used to determine how to extract long term memories. By default it will use “/” as the namespace.
- Memory strategy id → This is an optional field and it is the identifier for a memory strategy.
context = AgentCoreMemoryContext(
actor_id="<INSERT_HERE>",
memory_id="<INSERT_HERE>",
session_id="<INSERT_HERE>",
namespace="<INSERT_HERE>",
memory_strategy_id="<INSERT_HERE>",
)
agentcore_memory = AgentCoreMemory(context=context)
- This is an example of how to create a FunctionAgent in LlamaIndex. This sample adds a tool & the Claude Sonnet 4 LLM to the agent’s initialization.
If you would like to use this tool, the run the following command
%pip install llama-index-tools-yahoo-finance
from llama_index.llms.bedrock_converse import BedrockConverse
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.tools.yahoo_finance import YahooFinanceToolSpec
llm = BedrockConverse(model="us.anthropic.claude-sonnet-4-20250514-v1:0")
finance_tool_spec = YahooFinanceToolSpec()
agent = FunctionAgent(
tools=finance_tool_spec.to_tool_list(),
llm=llm,
)
Here's a simpler example that doesn't utilize a third party tool
from llama_index.core.tools import FunctionTool
from llama_index.core.agent.workflow import FunctionAgent
def call_fn(name: str):
"""Call the provided name.
Args:
name: str (Name of the person)
"""
print(f"Calling... {name}")
def email_fn(name: str):
"""Email the provided name.
Args:
name: str (Name of the person)
"""
print(f"Emailing... {name}")
call_tool = FunctionTool.from_defaults(fn=call_fn)
email_tool = FunctionTool.from_defaults(fn=email_fn)
agent = FunctionAgent(
tools=[call_tool, email_tool],
llm=llm,
)
- Invoke the agent to start conversations
This sample will invoke the tool and store the events in AgentCore Memory
response = await agent.run(
"What is the stock price of Amazon?", memory=agentcore_memory
)
After events are stored, you can then prompt the agent to answer any queries based on the memory records
response = await agent.run(
"What stock prices have I asked for?", memory=agentcore_memory
)
References
Metadata
Release files for llama-index-memory-bedrock-agentcore 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_memory_bedrock_agentcore-0.2.0.tar.gz | 10.5 kB | Without provenance | Details for llama_index_memory_bedrock_agentcore-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_memory_bedrock_agentcore-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_memory_bedrock_agentcore-0.2.0-py3-none-any.whl |
Total release size: 21.2 kB
Release files / llama_index_memory_bedrock_agentcore-0.2.0.tar.gz
| Download URL | llama_index_memory_bedrock_agentcore-0.2.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e347e8bedd93bfe64e6aa81f539b38049beeea60f93c53aa1582d9a00a604f96
|
|
BLAKE2b-256 checksum How to use checksums |
565a6736d898c51e103b37ea268398ccca857a3ac5669cdcc9da50003e0c89da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_memory_bedrock_agentcore-0.2.0-py3-none-any.whl
| Download URL | llama_index_memory_bedrock_agentcore-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb07123a34ebea26144c42d144cdc4e059d774b9f593f4c88688f5dee7f4a374
|
|
BLAKE2b-256 checksum How to use checksums |
57c17c198d173d6f0a47f465bb86a7afe22d835810ca674308ea95defc811bd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-memory-bedrock-agentcore 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.