Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions docs/src/content/docs/en/get_started/tutorials/dungeon-game/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,9 @@ This is the entrypoint for the agent, configured as a FastAPI application compat

```ts
// common/constructs/src/app/agents/story-agent.ts
import { Lazy, Names } from 'aws-cdk-lib';
import { FileSystem, Lazy, Names } from 'aws-cdk-lib';
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
import { Construct } from 'constructs';
import { execSync } from 'child_process';
import * as path from 'path';
import * as url from 'url';
import {
Expand All @@ -520,6 +519,7 @@ import {
Runtime,
RuntimeProps,
} from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { findWorkspaceRoot } from '../../../core/utils.js';

export type StoryAgentProps = Omit<
RuntimeProps,
Expand All @@ -533,14 +533,23 @@ export class StoryAgent extends Construct {
constructor(scope: Construct, id: string, props?: StoryAgentProps) {
super(scope, id);

this.dockerImage = AgentRuntimeArtifact.fromAsset(
const workspaceRoot = findWorkspaceRoot(
path.dirname(url.fileURLToPath(new URL(import.meta.url))),
);

this.dockerImage = AgentRuntimeArtifact.fromAsset(
path.join(workspaceRoot, 'packages/dungeon-adventure/story/src/agent'),
{
platform: Platform.LINUX_ARM64,
extraHash: execSync(
`docker inspect dungeon-adventure-story-agent:latest --format '{{.Id}}'`,
{ encoding: 'utf-8' },
).trim(),
buildContexts: {
workspace: workspaceRoot,
},
extraHash: FileSystem.fingerprint(
path.join(
workspaceRoot,
'dist/packages/dungeon-adventure/story/bundle/agent/story-agent',
),
),
},
);

Expand All @@ -557,9 +566,7 @@ export class StoryAgent extends Construct {
}
```

This configures a CDK `AgentRuntimeArtifact` which uploads your agent Docker image to ECR, and hosts it using AgentCore Runtime.

You may notice an extra `Dockerfile`, that references the Docker image from the `story` project, allowing us to co-locate the Dockerfile and agent source code.
This configures a CDK `AgentRuntimeArtifact` which uploads your agent Docker image to ECR, and hosts it using AgentCore Runtime. It uses CDK's `buildContexts` to reference the workspace root, allowing the Dockerfile to be co-located with the agent source code.

</Drawer>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/en/guides/py-mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ A `docker` target specific to your MCP server is also added, which:
- Builds a docker image from the `Dockerfile` which runs your MCP server on port `8000`, as per the [MCP protocol contract](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html#mcp-protocol-contract)

:::tip
The docker image is built using a tag (for example `my-scope-my-project-mcp-server:latest`), which is referenced by your CDK or Terraform infrastructure, allowing for your `Dockerfile` to be co-located with your MCP server project.
Your `Dockerfile` is co-located with your MCP server project. For CDK, the construct uses `buildContexts` to build the image directly from this Dockerfile. For Terraform, the docker image is pre-built using a tag (for example `my-scope-my-project-mcp-server:latest`) which is referenced by your Terraform infrastructure.
:::

### Observability
Expand Down
3 changes: 1 addition & 2 deletions docs/src/content/docs/en/guides/py-strands-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ For deploying your Strands Agent, the following files are generated:
- agents
- \<project-name>
- \<project-name>.ts CDK construct for deploying your agent
- Dockerfile Passthrough docker file used by the CDK construct
</FileTree>
</Fragment>
<Fragment slot="terraform">
Expand Down Expand Up @@ -283,7 +282,7 @@ A `docker` target specific to your Strands Agent is also added, which:
- Builds a docker image from the `Dockerfile` which runs your agent, as per the [AgentCore runtime contract](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html)

:::tip
The docker image is built using a tag (for example `my-scope-my-project-agent:latest`), which is referenced by your CDK or Terraform infrastructure, allowing for your `Dockerfile` to be co-located with your Strands Agent project.
Your `Dockerfile` is co-located with your Strands Agent project. For CDK, the construct uses `buildContexts` to build the image directly from this Dockerfile. For Terraform, the docker image is pre-built using a tag (for example `my-scope-my-project-agent:latest`) which is referenced by your Terraform infrastructure.
:::

### Authentication
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/en/guides/ts-mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ The bundle target uses `http.ts` as the entrypoint for the Streamable HTTP MCP s
The generator configures a `<your-server-name>-docker` target which runs the bundled Streamable HTTP MCP server on port `8000` as per the [MCP protocol contract](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html#mcp-protocol-contract).

:::tip
The docker image is built using a tag (for example `my-scope-my-project-mcp-server:latest`), which the CDK construct's `Dockerfile` inherits from, allowing for your `Dockerfile` to be co-located with your MCP server project.
Your `Dockerfile` is co-located with your MCP server project. For CDK, the construct uses `buildContexts` to build the image directly from this Dockerfile. For Terraform, the docker image is pre-built using a tag (for example `my-scope-my-project-mcp-server:latest`) which is referenced by your Terraform infrastructure.
:::

A `docker` target is also generated which runs the docker build for all MCP servers if you have multiple defined.
Expand Down
3 changes: 1 addition & 2 deletions docs/src/content/docs/en/guides/ts-strands-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ For deploying your Strands Agent, the following files are generated:
- agents
- \<project-name>
- \<project-name>.ts CDK construct for deploying your agent
- Dockerfile Passthrough docker file used by the CDK construct
</FileTree>
</Fragment>
<Fragment slot="terraform">
Expand Down Expand Up @@ -207,7 +206,7 @@ The bundle target uses `index.ts` as the entrypoint for the WebSocket server to
The generator configures a `<your-agent-name>-docker` target which runs the bundled WebSocket server on port `8080` as per the [AgentCore runtime contract](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html).

:::tip
The docker image is built using a tag (for example `my-scope-my-project-agent:latest`), which is referenced by your CDK or Terraform infrastructure, allowing for your `Dockerfile` to be co-located with your Strands Agent project.
Your `Dockerfile` is co-located with your Strands Agent project. For CDK, the construct uses `buildContexts` to build the image directly from this Dockerfile. For Terraform, the docker image is pre-built using a tag (for example `my-scope-my-project-agent:latest`) which is referenced by your Terraform infrastructure.
:::

A `docker` target is also generated which runs the docker build for all agents if you have multiple defined.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ For deploying your MCP Server, the following files are generated:
- mcp-servers
- \<project-name>
- \<project-name>.ts CDK construct for deploying your MCP Server
- Dockerfile Passthrough docker file used by the CDK construct
</FileTree>
</Fragment>
<Fragment slot="terraform">
Expand Down
27 changes: 17 additions & 10 deletions docs/src/content/docs/es/get_started/tutorials/dungeon-game/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,9 @@ Este es el punto de entrada para el agente, configurado como una aplicación Fas

```ts
// common/constructs/src/app/agents/story-agent.ts
import { Lazy, Names } from 'aws-cdk-lib';
import { FileSystem, Lazy, Names } from 'aws-cdk-lib';
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
import { Construct } from 'constructs';
import { execSync } from 'child_process';
import * as path from 'path';
import * as url from 'url';
import {
Expand All @@ -520,6 +519,7 @@ import {
Runtime,
RuntimeProps,
} from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { findWorkspaceRoot } from '../../../core/utils.js';

export type StoryAgentProps = Omit<
RuntimeProps,
Expand All @@ -533,14 +533,23 @@ export class StoryAgent extends Construct {
constructor(scope: Construct, id: string, props?: StoryAgentProps) {
super(scope, id);

this.dockerImage = AgentRuntimeArtifact.fromAsset(
const workspaceRoot = findWorkspaceRoot(
path.dirname(url.fileURLToPath(new URL(import.meta.url))),
);

this.dockerImage = AgentRuntimeArtifact.fromAsset(
path.join(workspaceRoot, 'packages/dungeon-adventure/story/src/agent'),
{
platform: Platform.LINUX_ARM64,
extraHash: execSync(
`docker inspect dungeon-adventure-story-agent:latest --format '{{.Id}}'`,
{ encoding: 'utf-8' },
).trim(),
buildContexts: {
workspace: workspaceRoot,
},
extraHash: FileSystem.fingerprint(
path.join(
workspaceRoot,
'dist/packages/dungeon-adventure/story/bundle/agent/story-agent',
),
),
},
);

Expand All @@ -557,9 +566,7 @@ export class StoryAgent extends Construct {
}
```

Esto configura un `AgentRuntimeArtifact` de CDK que sube tu imagen Docker del agente a ECR, y la aloja usando AgentCore Runtime.

Puedes notar un `Dockerfile` adicional, que referencia la imagen Docker del proyecto `story`, permitiéndonos ubicar conjuntamente el Dockerfile y el código fuente del agente.
Esto configura un `AgentRuntimeArtifact` de CDK que sube tu imagen Docker del agente a ECR, y la aloja usando AgentCore Runtime. Utiliza `buildContexts` de CDK para referenciar la raíz del workspace, permitiendo que el Dockerfile esté ubicado conjuntamente con el código fuente del agente.

</Drawer>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/es/guides/py-mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ También se añade un objetivo `docker` específico para tu servidor MCP, que:
- Construye una imagen Docker desde el `Dockerfile` que ejecuta tu servidor MCP en el puerto `8000`, según el [contrato de protocolo MCP](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html#mcp-protocol-contract)

:::tip
La imagen Docker se construye usando una etiqueta (por ejemplo `my-scope-my-project-mcp-server:latest`), que es referenciada por tu infraestructura CDK o Terraform, permitiendo que tu `Dockerfile` esté ubicado junto a tu proyecto de servidor MCP.
Tu `Dockerfile` está ubicado junto a tu proyecto de servidor MCP. Para CDK, el construct usa `buildContexts` para construir la imagen directamente desde este Dockerfile. Para Terraform, la imagen Docker se construye previamente usando una etiqueta (por ejemplo `my-scope-my-project-mcp-server:latest`) que es referenciada por tu infraestructura Terraform.
:::

### Observabilidad
Expand Down
9 changes: 3 additions & 6 deletions docs/src/content/docs/es/guides/py-strands-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Para desplegar tu Agente Strands, se generan los siguientes archivos:
- agents
- \<project-name>
- \<project-name>.ts Constructo CDK para desplegar tu agente
- Dockerfile Archivo Docker usado por el constructo CDK
</FileTree>
</Fragment>
<Fragment slot="terraform">
Expand Down Expand Up @@ -281,7 +280,7 @@ También se añade un target `docker` específico que:
- Construye una imagen Docker desde el `Dockerfile` que ejecuta tu agente según el [contrato de runtime de AgentCore](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html)

:::tip
La imagen Docker se construye con un tag (ej. `my-scope-my-project-agent:latest`), referenciado por tu infraestructura CDK/Terraform, permitiendo co-localizar el `Dockerfile` con tu proyecto.
Tu `Dockerfile` está co-localizado con tu proyecto de Agente Strands. Para CDK, el constructo usa `buildContexts` para construir la imagen directamente desde este Dockerfile. Para Terraform, la imagen Docker se pre-construye usando un tag (por ejemplo `my-scope-my-project-agent:latest`) que es referenciado por tu infraestructura Terraform.
:::

### Autenticación
Expand Down Expand Up @@ -462,8 +461,7 @@ Para autenticación IAM, la solicitud debe firmarse usando AWS Signature Version

```bash
acurl <region> bedrock-agentcore -N -X POST \
'https://bedrock
-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations' \
'https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations' \
-d '{"prompt": "what is 3 + 5?", "session_id": "abcdefghijklmnopqrstuvwxyz0123456789"}' \
-H 'Content-Type: application/json'
```
Expand All @@ -477,8 +475,7 @@ acurl <region> bedrock-agentcore -N -X POST \
Para autenticación Cognito, pasa el Access Token de Cognito en el header `Authorization`:

```bash
curl -N -X POST 'https://bedrock
-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations' \
curl -N -X POST 'https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations' \
-d '{"prompt": "what is 3 + 5?", "session_id": "abcdefghijklmnopqrstuvwxyz0123456789"}' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <access-token>"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/es/guides/ts-mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ El generador añadirá los siguientes archivos a tu proyecto TypeScript existent
- index.ts Exporta tu servidor
- server.ts Definición principal del servidor
- stdio.ts Punto de entrada para transporte STDIO, útil para servidores MCP locales simples
- http.ts Punto de entrada para transporte HTTP transmitible, útil para alojar tu servidor MCP
- http.ts Punto de entrada para transporte HTTP transmisible, útil para alojar tu servidor MCP
- tools/
- divide.ts Herramienta de ejemplo
- resources/
Expand Down Expand Up @@ -153,7 +153,7 @@ El objetivo bundle usa `http.ts` como punto de entrada para el servidor MCP HTTP
El generador configura un objetivo `<your-server-name>-docker` que ejecuta el servidor MCP HTTP transmisible empaquetado en el puerto `8000` según el [contrato de protocolo MCP](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html#mcp-protocol-contract).

:::tip
La imagen docker se construye usando un tag (por ejemplo `my-scope-my-project-mcp-server:latest`), del cual hereda el `Dockerfile` del constructo CDK, permitiendo que tu `Dockerfile` esté ubicado junto a tu proyecto de servidor MCP.
Tu `Dockerfile` está ubicado junto a tu proyecto de servidor MCP. Para CDK, el constructo usa `buildContexts` para construir la imagen directamente desde este Dockerfile. Para Terraform, la imagen docker se pre-construye usando un tag (por ejemplo `my-scope-my-project-mcp-server:latest`) que es referenciado por tu infraestructura Terraform.
:::

También se genera un objetivo `docker` que ejecuta la construcción docker para todos los servidores MCP si tienes múltiples definidos.
Expand Down
3 changes: 1 addition & 2 deletions docs/src/content/docs/es/guides/ts-strands-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ Para desplegar tu Strands Agent, se generan los siguientes archivos:
- agents
- \<project-name>
- \<project-name>.ts Constructo CDK para desplegar tu agente
- Dockerfile Archivo docker de paso utilizado por el constructo CDK
</FileTree>
</Fragment>
<Fragment slot="terraform">
Expand Down Expand Up @@ -207,7 +206,7 @@ El target bundle usa `index.ts` como punto de entrada para el servidor WebSocket
El generador configura un target `<your-agent-name>-docker` que ejecuta el servidor WebSocket empaquetado en el puerto `8080` según el [contrato de runtime de AgentCore](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html).

:::tip
La imagen docker se construye usando una etiqueta (por ejemplo `my-scope-my-project-agent:latest`), que es referenciada por tu infraestructura CDK o Terraform, permitiendo que tu `Dockerfile` esté co-ubicado con tu proyecto Strands Agent.
Tu `Dockerfile` está co-ubicado con tu proyecto Strands Agent. Para CDK, el constructo usa `buildContexts` para construir la imagen directamente desde este Dockerfile. Para Terraform, la imagen docker se pre-construye usando una etiqueta (por ejemplo `my-scope-my-project-agent:latest`) que es referenciada por tu infraestructura Terraform.
:::

También se genera un target `docker` que ejecuta la construcción docker para todos los agentes si tienes múltiples definidos.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Para implementar tu MCP Server, se generan los siguientes archivos:
- mcp-servers
- \<project-name>
- \<project-name>.ts Constructo CDK para implementar tu MCP Server
- Dockerfile Archivo Docker passthrough utilizado por el constructo CDK
</FileTree>
</Fragment>
<Fragment slot="terraform">
Expand Down
27 changes: 17 additions & 10 deletions docs/src/content/docs/fr/get_started/tutorials/dungeon-game/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,9 @@ C'est le point d'entrée de l'agent, configuré comme une application FastAPI co

```ts
// common/constructs/src/app/agents/story-agent.ts
import { Lazy, Names } from 'aws-cdk-lib';
import { FileSystem, Lazy, Names } from 'aws-cdk-lib';
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
import { Construct } from 'constructs';
import { execSync } from 'child_process';
import * as path from 'path';
import * as url from 'url';
import {
Expand All @@ -521,6 +520,7 @@ import {
Runtime,
RuntimeProps,
} from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { findWorkspaceRoot } from '../../../core/utils.js';

export type StoryAgentProps = Omit<
RuntimeProps,
Expand All @@ -534,14 +534,23 @@ export class StoryAgent extends Construct {
constructor(scope: Construct, id: string, props?: StoryAgentProps) {
super(scope, id);

this.dockerImage = AgentRuntimeArtifact.fromAsset(
const workspaceRoot = findWorkspaceRoot(
path.dirname(url.fileURLToPath(new URL(import.meta.url))),
);

this.dockerImage = AgentRuntimeArtifact.fromAsset(
path.join(workspaceRoot, 'packages/dungeon-adventure/story/src/agent'),
{
platform: Platform.LINUX_ARM64,
extraHash: execSync(
`docker inspect dungeon-adventure-story-agent:latest --format '{{.Id}}'`,
{ encoding: 'utf-8' },
).trim(),
buildContexts: {
workspace: workspaceRoot,
},
extraHash: FileSystem.fingerprint(
path.join(
workspaceRoot,
'dist/packages/dungeon-adventure/story/bundle/agent/story-agent',
),
),
},
);

Expand All @@ -558,9 +567,7 @@ export class StoryAgent extends Construct {
}
```

Cela configure un `AgentRuntimeArtifact` CDK qui télécharge votre image Docker d'agent vers ECR et l'héberge en utilisant AgentCore Runtime.

Vous remarquerez peut-être un `Dockerfile` supplémentaire qui référence l'image Docker du projet `story`, nous permettant de co-localiser le Dockerfile et le code source de l'agent.
Cela configure un `AgentRuntimeArtifact` CDK qui télécharge votre image Docker d'agent vers ECR et l'héberge en utilisant AgentCore Runtime. Il utilise `buildContexts` de CDK pour référencer la racine du workspace, permettant au Dockerfile d'être co-localisé avec le code source de l'agent.

</Drawer>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/fr/guides/py-mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Une cible `docker` spécifique à votre serveur MCP est aussi ajoutée. Elle :
- Construit une image Docker depuis le `Dockerfile` exécutant votre serveur MCP sur le port `8000`, conformément au [contrat de service MCP](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html#mcp-protocol-contract)

:::tip
L'image Docker est construite avec un tag (ex: `my-scope-my-project-mcp-server:latest`), référencé par votre infrastructure CDK/Terraform, permettant à votre `Dockerfile` de rester colocalisé avec votre projet de serveur MCP.
Votre `Dockerfile` reste colocalisé avec votre projet de serveur MCP. Pour CDK, le construct utilise `buildContexts` pour construire l'image directement depuis ce Dockerfile. Pour Terraform, l'image Docker est pré-construite avec un tag (par exemple `my-scope-my-project-mcp-server:latest`) qui est référencé par votre infrastructure Terraform.
:::

### Observabilité
Expand Down
Loading
Loading