Support allowedPorts (session endpoints) on runtimes

Open
#2,811 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
aws, typescript
Domain
cli, cloud

Research direction

Start by reading RuntimeSpecSchema in the @aws/agentcore CLI and trace how agentcore deploy creates and updates runtimes. Then check the AgentCoreRuntime construct in @aws/agentcore-cdk and the runtime and invoke commands; CloudFormation support for AllowedPorts is a stated dependency. Done means the spec accepts the documented port rules, deploys preserve the setting, and the relevant commands can print a session endpoint URL.

Written by the indexing model from the issue text.

Description

Description

A runtime's agentcore.json spec has no field for allowedPorts, so a project deployed with agentcore deploy cannot enable session endpoints. The gap is also in CloudFormation: AWS::BedrockAgentCore::Runtime has no AllowedPorts property (checked with aws cloudformation describe-type --type RESOURCE --type-name AWS::BedrockAgentCore::Runtime in ap-southeast-1). Today the only way to get the setting is to call CreateAgentRuntime or UpdateAgentRuntime directly, outside the project.

Patching the runtime after agentcore deploy does not hold up. UpdateAgentRuntime replaces the whole configuration, so the next deploy is likely to drop allowedPorts again, and the session endpoint stops working with no error.

Our use case is an agent that serves a REST API with server-sent events. We want to reach it through each session's endpoint, because InvokeAgentRuntime turns any non-2xx answer into 424 RuntimeClientError and drops the response's headers. We have worked around this by wrapping our API inside /invocations. We would rather use session endpoints, which is what they are for.

Acceptance Criteria
  • A runtime in agentcore.json accepts allowedPorts with the API's rules: 1–5 entries, each a port or a portRange, within 8000–12000, and none of them reserved.
  • agentcore deploy creates and updates the runtime with them, and a later deploy keeps them.
  • The AgentCoreRuntime construct in @aws/agentcore-cdk exposes them (this depends on CloudFormation supporting AllowedPorts on AWS::BedrockAgentCore::Runtime).
  • agentcore invoke, or the runtime commands, can print a session's sessionEndpointUrl.
Additional Context
  • CLI @aws/agentcore 1.0.3 and @aws/agentcore-cdk 1.0.3: RuntimeSpecSchema has no allowedPorts field.
  • On a runtime created through the API with allowedPorts: [{ port: 8080 }], the session endpoint passes every method, path, status code, header and SSE stream as documented, with about the same latency as InvokeAgentRuntime.
Dominant language
TypeScript
Stars
339
Forks
129
Avg merge
19h 21m
Merged PRs (30d)
125

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/agentcore-cli

All issues in aws/agentcore-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.