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.0.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.0.tar.gz.
File metadata
- Download URL: cdk_agent_broker-0.0.0.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 |
8d173ce84bc46c40fed0888a49888316832ff0c2b085c7d5f05dfc67f77edd3b
|
|
| MD5 |
abac3b94a4f6aeb20c2576da89816172
|
|
| BLAKE2b-256 |
46c1c6fff443f5f4ff7b8151ed9ce9c0004ec2f89154fb9d0acc0230b64b6fd7
|
File details
Details for the file cdk_agent_broker-0.0.0-py3-none-any.whl.
File metadata
- Download URL: cdk_agent_broker-0.0.0-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 |
f144e8db45a882401c578ff28a813e281ac71bb63c46ce65cd4df27a4b363436
|
|
| MD5 |
8ef8391130c394ffe95f4574ca1c257d
|
|
| BLAKE2b-256 |
9966991c2986edf5628c72f327a5bd0fd662f0cef268ce80b9cfb80bf4dda359
|