feat: AgentCore CDK construct with built-in agent template#12
Open
aakash-cddo wants to merge 18 commits into
Open
feat: AgentCore CDK construct with built-in agent template#12aakash-cddo wants to merge 18 commits into
aakash-cddo wants to merge 18 commits into
Conversation
…m/co-cddo/gds-idea-cdk-constructs-new into ap/feature/agentcore_runtime_base
…updated props into twp groups of agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AgentCoreCDK construct that deploys an Amazon Bedrock AgentCore runtime with short-term memory, IAM permissions, and observability pre-configuredWebAppconstruct (props dataclass,__init__.pyexports, no "Stack" suffix)What
CDK Construct (
agent_core/)props.py—AgentCorePropertiesdataclass with two typed agent modes and sensible defaults. Onlyruntime_nameis required:BuiltInAgent— use the built-in template; configure viaModelConfig(model ID, token limits, thinking budget) and system promptCustomAgent— bring your own agent code directory; the construct automatically injectsREGION,MODEL_ID, andMEMORY_IDMemoryConfig— typed memory store config (set toNoneto skip creation)ModelConfig— synth-time validated model config (enforcesbudget_tokens < max_tokens)stack.py—AgentCoreconstruct that provisions:__init__.py— exportsAgentCore,AgentCoreProperties,BuiltInAgent,CustomAgent,ModelConfig, andMemoryConfigAgent Template (
agent_core/agent_template/)A complete, runnable agent built into a Docker image by CDK:
agent.py— Strands-based conversational agent with streaming, extended thinking, and session memory via AgentCore Memory Store_config.py— frozenConfigdataclass that loads all runtime configuration from environment variables_logging.py— structured JSON logging for CloudWatch_metrics.py— token usage extraction and OpenTelemetry span recording_streaming.py— stream event parsing helpersDockerfile— slim Python 3.13 image with uv, non-root userdefault_system_prompt.md— minimal starting promptTests
tests/agent_core/test_props.py— unit tests for all props dataclasses and validation logic (includingModelConfigconstraint enforcement)tests/agent_core/test_stack.py— CDK synth tests covering the full construct, IAM permissions, memory config, and custom agent mode; tests structured as functions (not classes)tests/fixtures/fake_agent/Dockerfile— minimal test fixture for the custom agent code pathOther
README.md— AgentCore section with quick start, full props table, and custom agent code instructionspyproject.toml— addedaws-cdk-aws-bedrock-agentcore-alphadependency; excludedagent_template/from host ruff (it has its own runtime context)Usage
Zero-config
Configured (built-in agent)
Custom agent code