aws / aws/bedrock-agentcore-starter-toolkit
[Enhancement] Add the ability to invoke an existing agent on the Runtime - instead of configure then launch
- Dominant language
- Python
- Stars
- 508
- Forks
- 155
- Avg merge
- 8h 50m
- Merged PRs (30d)
- 4
Description
Hello,
As of today, users using the Runtime must configure then invoke the deployed agent:
### Current behavior
```python
# 1. configure the agent runtime
from bedrock_agentcore_starter_toolkit import Runtime
agentcore_runtime = Runtime()
agent_name = "strands_claude_getting_started"
response = agentcore_runtime.configure(
entrypoint="strands_claude.py",
auto_create_execution_role=True,
auto_create_ecr=True,
requirements_file="requirements.txt",
region=region,
agent_name=agent_name
)
# 2. launch the agent into the runtime
launch_result = agentcore_runtime.launch()
#3 invoke the agent
invoke_response = agentcore_runtime.invoke({"prompt": "How is the weather now?"})
```
### Desired enhancement to add
Let us assume that the user has already deployed their Agent to AgentCore runtime and has configured Cognito Auth. The user might want to use the starter toolkit as it supports bearer_token which is not currently supported in Boto3. An implementation could be something like this:
```python
# 1. import an existing agent from runtime
imported_agent = agentcore_runtime.configure_existing_agent(
agent_arn="AGENT_ARN",
region=region,
)
# 2. Invoke the imported agent.
invoke_response = imported_agent .invoke({"prompt": "How is the weather now?"}, bearer_token="INSERT_TOKEN",
custom_headers="INSERT_CUSTOM_HEADERS")
```
### Why?
I was working on a implementation, where we had already deployed our AI agent into the runtime from the CLI and then we needed to invoke the agent using a bearer token. Unfortunately, Boto3 does not support bearer token and it seems the starter tooklkit should provide a convenient way for users to import existing agent and invoke it using bearer token without needing to configure it first.
Contributor guide
Research direction
Start with the Runtime entry points configure(), launch(), and invoke(), then compare the proposed configure_existing_agent() flow with the existing CLI/runtime behavior described here. Done means an existing agent can be imported by ARN and invoked with bearer_token and custom_headers while preserving the current configure-then-launch path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authentication, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100