# @aws/agentcore-cdk

L3 CDK constructs for Amazon Bedrock AgentCore. Deploy agent infrastructure with strongly-typed, declarative
specifications.

## Installation

```bash
npm install @aws/agentcore-cdk
```

**Note:** `aws-cdk-lib` and `constructs` are peer dependencies. If you don't already have them:

```bash
npm install @aws/agentcore-cdk aws-cdk-lib constructs
```

## Quick Start

```typescript
import { AgentCoreApplication, AgentCoreMcp } from '@aws/agentcore-cdk';
import type { AgentCoreProjectSpec } from '@aws/agentcore-cdk';
import { Stack } from 'aws-cdk-lib';

const spec: AgentCoreProjectSpec = {
  name: 'myProject',
  version: 1,
  agents: [
    {
      type: 'AgentCoreRuntime',
      name: 'myAgent',
      build: 'CodeZip',
      entrypoint: 'main.py',
      codeLocation: 'app/myAgent/',
      runtimeVersion: 'PYTHON_3_12',
    },
  ],
};

class MyStack extends Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id);
    new AgentCoreApplication(this, 'App', { spec });
  }
}
```

## Constructs

### AgentCoreApplication

Main L3 construct for deploying agent environments.

### AgentCoreMcp

L3 construct for MCP gateways and tools.

### AgentEnvironment

Individual agent environment construct.

## Standalone Usage

These constructs can be used independently without the CLI:

```typescript
import { AgentCoreApplication, ConfigIO } from '@aws/agentcore-cdk';

// Option 1: Pass spec directly
new AgentCoreApplication(this, 'App', {
  spec: {
    name: 'myProject',
    version: 1,
    agents: [
      {
        type: 'AgentCoreRuntime',
        name: 'myAgent',
        build: 'CodeZip',
        entrypoint: 'main.py',
        codeLocation: 'app/myAgent/',
        runtimeVersion: 'PYTHON_3_12',
      },
    ],
  },
});

// Option 2: Read from disk (using built-in ConfigIO)
const configIO = new ConfigIO({ baseDir: './agentcore' });
const spec = await configIO.readProjectSpec();
new AgentCoreApplication(this, 'App', { spec });
```

## Related Package

- `@aws/agentcore` - CLI tool that uses these constructs via templated CDK projects

## Security

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.

## License

This project is licensed under the Apache-2.0 License.
