Skip to content

feat(project): scaffold add runtime handler - #2035

Merged
Hweinstock merged 17 commits into
aws:refactorfrom
Hweinstock:refactor-add-runtime
Aug 21, 2026
Merged

feat(project): scaffold add runtime handler#2035
Hweinstock merged 17 commits into
aws:refactorfrom
Hweinstock:refactor-add-runtime

Conversation

@Hweinstock

@Hweinstock Hweinstock commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem

add runtime is missing.

Solution

  • add support for project add runtime mostly mirroring the schema shapes.
  • support two modes template and byo (import OOS here). We then use this input schema to scaffold the project, and resolve the config that goes into agentcore.json (to be implemented).
  • new template flag describes templates like strands-python, which can be adjusted with flags (ex. --build Container, or --protocol mcp, with defaults for each template. This will keep us flexible to support more templates in the future.

Testing

  • added unit tests for handler parsing, with implementation details to be filled in.

@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 19, 2026
@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.64286% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.15%. Comparing base (63ed69c) to head (9811509).
⚠️ Report is 1 commits behind head on refactor.

Files with missing lines Patch % Lines
src/handlers/project/add/runtime/index.ts 99.52% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #2035      +/-   ##
============================================
+ Coverage     97.11%   97.15%   +0.04%     
============================================
  Files           384      386       +2     
  Lines         22711    22984     +273     
============================================
+ Hits          22055    22330     +275     
+ Misses          656      654       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 19, 2026
@Hweinstock
Hweinstock force-pushed the refactor-add-runtime branch from 4423362 to 473c989 Compare August 19, 2026 15:18
@Hweinstock Hweinstock changed the title feat(project): scaffold add runtime handler (2) feat(project): scaffold add runtime handler Aug 19, 2026
@Hweinstock
Hweinstock marked this pull request as ready for review August 19, 2026 18:50
flag("entrypoint", "entrypoint file, e.g. main.py:handler (BYO only)", z.string().optional()),
flag("protocol", "server protocol: HTTP, MCP, A2A, AGUI", ProtocolModeSchema.optional()),
flag(
"api-key",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mark this as sensitive

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call!

`--${templateOnlyFlags[0]} is only available on the template path (--template)`,
);

const inputEnvironmentVariables = parseJsonFlag<Record<string, string>>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth changing this to parseJsonFlagWithSchema, and passing in z.record(EnvVarNameSchema, z.string()). That way we aren't accepting null, 0, etc. into env vars

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should get validated on line 209 below, since we borrow the env var shape from the existing schema.

]);
export type RuntimeMemoryConfig = z.input<typeof runtimeMemoryConfigSchema>;

const RuntimeInfraConfigSchema = z.object({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq: I see ProjectRuntimeSchema has a bunch of superRefines validating/invalidating flags that need to be used in combination (etc. ensures VPC always has a network config). Is that something we'll account for in the implementation PR or do we need those here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should still surface these errors to the customer since we validate the schema before write, but this made me realize a small bug where this wouldn't rollback the scaffolded files. Fixing that here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on the rollback. With that fix I have no concerns about the validation happening later in the chain

RuntimeResourceConfigSchema,
} from "./types";

export const createAddRuntimeHandler = (config: AddProjectResourceConfig) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOS but a suggestion that we should try to adopt across the board. Can we divide flags into "basic" and "advanced" so that it is decluttered for the user to see when they type in agentcore project add runtime --help

here is how vercel does it:

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is interesting!

tags: parseTags(flags["tags"]),
};

const runtimeInput = isTemplate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like --build is accepted for templates but never added to runtimeInput, and the template schema strips it as well.

This means --build Container is silently ignored. Could we include build in the template config?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good catch. I was initially thinking build would go in here, but the existing asset templates don't actually leverage it and instead have separate templates for build.

I'm working on the template doc now, so this behavior will likely change. I'm making a note to come back to this when we implement the handler to make sure its consistent.

@jariy17 jariy17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its good, the nits could be a follow up pr.

RuntimeResourceConfigSchema,
} from "./types";

export const createAddRuntimeHandler = (config: AddProjectResourceConfig) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea

const entrypoint = flags.entrypoint ?? "main.py";

const source = new SourceResolver({ stdin: config.io.stdin });
const apiKey = await source.resolveText("api-key", flags["api-key"]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at Tejas's PR, we shouldn't allow inline secrets. I asked Tejas to shift this helper functino into SourceResolver.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is some inconsistency here since runtime does allow this:

const bearerToken = await resolver.resolveText("bearer-token", sources.bearerToken);
.

I'm going to merge to avoid conflicts, and make a follow-up task to align on consistent behavior here.

@Hweinstock
Hweinstock merged commit b566b33 into aws:refactor Aug 21, 2026
8 of 16 checks passed
@Hweinstock
Hweinstock deleted the refactor-add-runtime branch August 21, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants