AWS CDK constructs library for Agent Broker
Project description
cdk-agent-broker
AWS CDK constructs library for deploying Agent Broker on AWS ECS Fargate.
Architecture
┌──────────────────────────────────────────────────────────────┐
│ AWS Cloud │
│ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ VPC (default: 10.168.0.0/16) │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────┐ │ │
│ │ │ Public Subnet │ │ │
│ │ │ │ │ │
│ │ │ ┌────────────────────────────────────────────┐ │ │ │
│ │ │ │ ECS Cluster │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ ┌──────────────────────────────────────┐ │ │ │ │
│ │ │ │ │ Fargate Service (FARGATE_SPOT| FARGATE)│ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ ┌──────────┐ ┌────────────────┐ │ │ │ │ │
│ │ │ │ │ │ config- │ │ app container │ │ │ │ │ │
│ │ │ │ │ │ init │───▶│ (port 80) │ │ │ │ │ │
│ │ │ │ │ │(required)│ │ │ │ │ │ │ │
│ │ │ │ │ └──────────┘ └───────┬────────┘ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ ┌───────────────────────┴────────┐ │ │ │ │ │
│ │ │ │ │ │ EBS Volume (GP3, 10 GiB) │ │ │ │ │ │
│ │ │ │ │ │ mount: /home/agent │ │ │ │ │ │
│ │ │ │ │ └────────────────────────────────┘ │ │ │ │ │
│ │ │ │ └──────────────────────────────────────┘ │ │ │ │
│ │ │ └────────────────────────────────────────────┘ │ │ │
│ │ └──────────────────────────────────────────────────┘ │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────┐ │
│ │ S3 (config │ ◀── config.toml (required) │
│ │ asset) │ │
│ └──────────────┘ │
└──────────────────────────────────────────────────────────────┘
Install
# npm
npm install cdk-agent-broker
# pip
pip install cdk-agent-broker
Usage
import { AgentBroker } from 'cdk-agent-broker';
new AgentBroker(this, 'Broker', {
configPath: './config.toml', // required: path to your local config.toml
});
// With custom settings
new AgentBroker(this, 'Broker', {
cpu: 2048,
memoryLimitMiB: 4096,
ebsSizeGiB: 20,
configPath: './config.toml',
});
Props
| Prop | Type | Default | Description |
|---|---|---|---|
vpc |
ec2.IVpc |
New VPC (public subnet) | 自訂 VPC |
vpcCidr |
string |
10.168.0.0/16 |
新建 VPC 的 CIDR |
image |
ecs.ContainerImage |
ghcr.io/thepagent/agent-broker:dd7e1ca |
Container image |
memoryLimitMiB |
number |
4096 |
Task memory (MiB) |
cpu |
number |
2048 |
Task CPU units |
assignPublicIp |
boolean |
true |
是否分配 public IP |
enableFargateSpot |
boolean |
true |
啟用 FARGATE_SPOT |
ebsSizeGiB |
number |
10 |
EBS volume 大小 (GiB) |
ebsMountPath |
string |
/home/agent |
EBS 掛載路徑 |
configPath |
string |
必填 | 本地 config.toml 路徑,透過 S3 init container 掛載到 /etc/agent-broker/config.toml |
Exposed Resources
AgentBroker construct 暴露以下屬性,方便後續串接:
broker.vpc— VPCbroker.cluster— ECS Clusterbroker.service— Fargate Service
Config Init Container Flow
- 本地 config.toml 透過
s3-assets上傳到 S3 config-initinit container 使用aws-cli從 S3 下載到/etc/agent-broker/config.toml- App container 等待 init container 完成後啟動,並以 read-only 方式掛載 config volume
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cdk_agent_broker-0.0.1.tar.gz
(38.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdk_agent_broker-0.0.1.tar.gz.
File metadata
- Download URL: cdk_agent_broker-0.0.1.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf455963aaa458a9a5ce696774907775333466ede67b7f9a3fd7a2963a70be2e
|
|
| MD5 |
7652f959663114c36190c1b699f8d27f
|
|
| BLAKE2b-256 |
a04a83eb613afa96bfb33566b2f3273c0d41a58ec9531fca928f4e80f66a8729
|
File details
Details for the file cdk_agent_broker-0.0.1-py3-none-any.whl.
File metadata
- Download URL: cdk_agent_broker-0.0.1-py3-none-any.whl
- Upload date:
- Size: 37.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d645ab75ea02667ae9e0dd8db89cf89868e68b6fe5b9c5bdc88aeb7ef986868a
|
|
| MD5 |
498c0a1d1240a4ad73fb7c762f6266ae
|
|
| BLAKE2b-256 |
ac451f94f00d46e6ff3833de38b1ff19d42e5ccd9c6d899f18ab60edd69c9e4e
|