@@ -19,61 +19,70 @@ one-command deploy to AWS.
1919
2020## Prerequisites
2121
22- | Tool | Version |
23- | ---| ---|
24- | AWS CLI | configured (` aws configure ` ) |
25- | Node.js | 18+ |
26- | Python | 3.8+ |
27- | Docker | running |
22+ - ** AWS CLI** — configured (` aws configure ` )
23+ - ** Node.js** 18+
24+ - ** Python** 3.8+
25+ - ** Docker** — running
2826
2927## Deploy
3028
31- ** 1. Clone the example**
32-
33- ``` bash
34- git clone https://github.com/CopilotKit/CopilotKit.git
35- cd CopilotKit/examples/integrations/agentcore
36- ```
37-
38- ** 2. Configure**
39-
40- ``` bash
41- cp config.yaml.example config.yaml
42- ```
43-
44- Edit ` config.yaml ` and set ` stack_name_base ` (a short prefix for your AWS resources) and
45- ` admin_user_email ` (where your Cognito invite will be sent).
29+ The CLI scaffolds the project, sets up your config, and a single script deploys the full stack — CDK infrastructure, AgentCore Runtime, and the frontend — in one shot.
4630
47- ** 3. Deploy**
31+ <Steps >
32+ <Step >
33+ ### Scaffold the project
4834
49- <Tabs groupId = " agent-framework" items = { [" LangGraph" , " Strands" ]} >
50- <Tab value = " LangGraph" >
51- ``` bash
52- ./deploy-langgraph.sh
53- ```
54- </Tab >
55- <Tab value = " Strands" >
5635 ``` bash
57- ./deploy-strands.sh
36+ npx copilotkit@latest create -f agentcore-langgraph
37+ # or
38+ npx copilotkit@latest create -f agentcore-strands
5839 ```
59- </Tab >
60- </Tabs >
40+ </Step >
6141
62- The script deploys the full CDK stack and prints an Amplify URL when done. Sign in with your
63- ` admin_user_email ` .
42+ < Step >
43+ ### Configure
6444
65- <Callout type = " info" title = " Prefer Terraform?" >
66- A Terraform equivalent is available in ` infra-terraform/ ` . See ` infra-terraform/README.md ` for
67- setup and deploy steps.
68- </Callout >
45+ ``` bash
46+ cp config.yaml.example config.yaml
47+ ```
6948
70- <Callout type = " info" title = " Infra only" >
71- Pass ` --skip-frontend ` to deploy or update the agent and infrastructure without rebuilding
72- the frontend:
73- ``` bash
74- ./deploy-langgraph.sh --skip-frontend
75- ```
76- </Callout >
49+ Edit ` config.yaml ` and set ` stack_name_base ` (a short prefix for your AWS resources) and
50+ ` admin_user_email ` (where your Cognito invite will be sent).
51+ </Step >
52+
53+ <Step >
54+ ### Deploy
55+
56+ <Tabs groupId = " agent-framework" items = { [" LangGraph" , " Strands" ]} >
57+ <Tab value = " LangGraph" >
58+ ``` bash
59+ ./deploy-langgraph.sh
60+ ```
61+ </Tab >
62+ <Tab value = " Strands" >
63+ ``` bash
64+ ./deploy-strands.sh
65+ ```
66+ </Tab >
67+ </Tabs >
68+
69+ The script deploys the full CDK stack and prints an Amplify URL when done. Sign in with your
70+ ` admin_user_email ` .
71+
72+ <Callout type = " info" title = " Prefer Terraform?" >
73+ A Terraform equivalent is available in ` infra-terraform/ ` . See ` infra-terraform/README.md ` for
74+ setup and deploy steps.
75+ </Callout >
76+
77+ <Callout type = " info" title = " Infra only" >
78+ Pass ` --skip-frontend ` to deploy or update the agent and infrastructure without rebuilding
79+ the frontend:
80+ ```bash
81+ ./deploy-langgraph.sh --skip-frontend
82+ ```
83+ </Callout >
84+ </Step >
85+ </Steps >
7786
7887## Local development
7988
@@ -119,57 +128,10 @@ frontend passes this token as a Bearer header to the CopilotKit Lambda. The Lamb
119128it to AgentCore, which validates it and makes the ` sub ` claim available to the agent as the
120129user identity.
121130
122- ## Generative UI
123-
124- The agent renders charts and UI components directly in the chat by calling frontend tools.
125- The frontend registers these tools with ` useCopilotAction ` :
126-
127- ``` tsx
128- useCopilotAction ({
129- name: " barChart" ,
130- parameters: [
131- { name: " data" , type: " object[]" },
132- { name: " title" , type: " string" },
133- ],
134- render : ({ data , title }) => <BarChart data = { data } title = { title } />,
135- });
136- ```
137-
138- The agent calls ` barChart ` with data (fetched first via ` query_data ` ), and the chart
139- appears inline in the chat — no extra user interaction needed.
140-
141- ## Shared state
142-
143- The todo canvas demonstrates bidirectional state sync between the agent and the frontend.
144- The agent maintains a ` todos ` list in its state; the frontend reads and writes it in real time.
145-
146- ** Agent side** (LangGraph):
147- ``` python
148- class AgentState (BaseAgentState ):
149- todos: list[Todo]
150-
151- @tool
152- def manage_todos (todos : list[Todo], runtime : ToolRuntime) -> Command:
153- """ Replace the entire todo list."""
154- return Command(update = {" todos" : todos, " messages" : [... ]})
155- ```
156-
157- ** Frontend side:**
158- ``` tsx
159- const { agent } = useAgent ();
160-
161- // Read agent state
162- const todos = agent .state ?.todos ?? [];
163-
164- // Write agent state (user interaction)
165- agent .setState ({ todos: updatedTodos });
166- ```
167-
168- The agent calls ` manage_todos ` to update todos; the UI reacts instantly. Users can also
169- edit todos directly and those changes flow back to the agent's state.
170-
171131## Tear down
172132
133+ When you're done experimenting, run this to delete all AWS resources created by the deployment — the AgentCore Runtime, Cognito user pool, Lambda, API Gateway, and Amplify app. This stops any ongoing AWS charges.
134+
173135``` bash
174136cd infra-cdk && npx cdk destroy --all
175137```
0 commit comments