Deploy supporting infrastructure for Valyu + AgentCore Gateway.
The valyu-gateway.yaml template creates authentication and supporting infrastructure:
- Cognito User Pool - OAuth authentication for gateway access
- Cognito App Client - Client credentials for machine-to-machine auth
- IAM Role - Permissions for gateway to invoke tools
- Secrets Manager - Secure storage for Valyu API key
- CloudWatch Log Group - Audit logging
Note: This template creates the supporting infrastructure. You still need to create the AgentCore Gateway itself using either the Python SDK or AWS Console (see below).
The simplest approach - creates everything including the gateway:
from valyu_agentcore.gateway import setup_valyu_gateway, GatewayAgent
# Creates gateway + Cognito auth + Valyu target
setup_valyu_gateway()
# Use it
with GatewayAgent.from_config() as agent:
response = agent("Search for NVIDIA SEC filings")
print(response)Use CloudFormation for auth infrastructure, then add Valyu to your gateway:
# 1. Deploy auth infrastructure
aws cloudformation create-stack \
--stack-name valyu-gateway \
--template-body file://valyu-gateway.yaml \
--parameters ParameterKey=ValyuApiKey,ParameterValue=YOUR_VALYU_API_KEY \
--capabilities CAPABILITY_NAMED_IAM
# 2. Create gateway in AWS Console, then add Valyu target:
python -c "
from valyu_agentcore.gateway import add_valyu_target
add_valyu_target(gateway_id='your-gateway-id')
"- Deploy the CloudFormation stack (see below)
- Go to Amazon Bedrock > AgentCore > Gateways
- Click Create gateway
- Click Add target and use the
ValyuMcpEndpointfrom stack outputs
- Go to CloudFormation in AWS Console
- Click Create stack > With new resources
- Upload
valyu-gateway.yaml - Enter parameters:
ValyuApiKey: Your key from platform.valyu.aiGatewayName: Name for your gateway (default:valyu-gateway)
- Click Create stack
aws cloudformation create-stack \
--stack-name valyu-gateway \
--template-body file://valyu-gateway.yaml \
--parameters \
ParameterKey=ValyuApiKey,ParameterValue=YOUR_VALYU_API_KEY \
--capabilities CAPABILITY_NAMED_IAM| Output | Description |
|---|---|
UserPoolId |
Cognito User Pool ID |
UserPoolClientId |
App client ID for authentication |
TokenEndpoint |
OAuth token endpoint URL |
GatewayRoleArn |
IAM role for the gateway |
ValyuMcpEndpoint |
Valyu MCP endpoint URL (use this when adding target) |
aws cloudformation delete-stack --stack-name valyu-gatewayTo deploy this template, you need:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:*",
"cognito-idp:*",
"iam:CreateRole",
"iam:DeleteRole",
"iam:PutRolePolicy",
"iam:DeleteRolePolicy",
"iam:PassRole",
"secretsmanager:CreateSecret",
"secretsmanager:DeleteSecret",
"logs:CreateLogGroup",
"logs:DeleteLogGroup"
],
"Resource": "*"
}
]
}