Deploy a Valyu-powered research agent to AWS Bedrock AgentCore Runtime.
User Request
│
▼
┌─────────────────────────────┐
│ AgentCore Runtime │
│ (Serverless container) │
│ │
│ ┌─────────────────────┐ │
│ │ Strands Agent │ │
│ └──────────┬──────────┘ │
│ │ │
└──────────────┼──────────────┘
│ MCP + OAuth
▼
┌─────────────────────────────┐
│ AgentCore Gateway │
│ (Centralized tool access) │
└──────────────┬──────────────┘
│
▼
┌──────────────┐
│ Valyu MCP │
└──────────────┘
- AWS CLI configured (
aws configure) - Python 3.10+
- Valyu API key from platform.valyu.ai
pip install "valyu-agentcore[agentcore]"First, create a Gateway with Valyu tools:
cd /path/to/valyu-agentcore/examples/gateway
export VALYU_API_KEY=your-valyu-api-key
python setup_gateway.pyThis creates valyu_gateway_config.json in the gateway folder.
cp valyu_gateway_config.json ../runtime/
cd ../runtime# Configure (creates .bedrock_agentcore.yaml)
agentcore configure --entrypoint agent.py --non-interactive --name valyuagent
# Deploy to AWS (uses CodeBuild, no Docker needed)
agentcore launch
# Test it
agentcore invoke '{"prompt": "What is the current stock price of NVIDIA?"}'The agent is now running in AWS and can answer questions using Valyu search tools.
Instead of copying the config file, you can set environment variables when deploying:
agentcore launch \
--env GATEWAY_URL=https://your-gateway.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp \
--env COGNITO_CLIENT_ID=your-client-id \
--env COGNITO_CLIENT_SECRET=your-client-secret \
--env COGNITO_DOMAIN=your-cognito-domain \
--env COGNITO_SCOPE=your-gateway-name/invoke- Agent starts in Runtime container
- Reads Cognito credentials from config file or environment
- Gets fresh OAuth token from Cognito on each request
- Calls Gateway with Bearer token
- Gateway routes request to Valyu MCP
- Valyu returns search results
- Agent uses results to answer the question
| File | Purpose |
|---|---|
agent.py |
The agent code that runs in Runtime |
requirements.txt |
Python dependencies |
valyu_gateway_config.json |
Gateway credentials (you copy this from gateway folder) |
"No such file: valyu_gateway_config.json"
- You need to copy the config from the gateway folder
- Run:
cp ../gateway/valyu_gateway_config.json .
"GATEWAY_URL not found"
- Either copy the config file OR set environment variables
- See "Alternative: Environment Variables" above
Token/auth errors
- Make sure you ran
setup_gateway.pyfirst - Check that the config file has valid credentials
"Agent not found"
- Run
agentcore configurebeforeagentcore launch
To delete the deployed agent:
# List agents
aws bedrock-agentcore-control list-agent-runtimes --region us-east-1
# Delete agent
aws bedrock-agentcore-control delete-agent-runtime \
--agent-runtime-id YOUR_AGENT_ID \
--region us-east-1To delete the Gateway (from the gateway folder):
cd ../gateway
python setup_gateway.py cleanup