Skip to main content

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) │  │  │  │  │
│  │  │  │  │                                           │  │  │  │  │
│  │  │  │  │  ┌───────────┐  ┌──────────────────────┐  │  │  │  │  │
│  │  │  │  │  │ data-init │─▶│  app container       │  │  │  │  │  │
│  │  │  │  │  │ (S3 pull) │  │  (port 80)           │  │  │  │  │  │
│  │  │  │  │  └───────────┘  └──────────┬───────────┘  │  │  │  │  │
│  │  │  │  │                            │ stops        │  │  │  │  │
│  │  │  │  │                            ▼              │  │  │  │  │
│  │  │  │  │                 ┌───────────────────────┐ │  │  │  │  │
│  │  │  │  │                 │ data-backup (sidecar) │ │  │  │  │  │
│  │  │  │  │                 │ S3 sync on app stop   | │  │  │  │  │
│  │  │  │  │                 └───────────────────────│ │  │  │  │  |
│  │  │  │  └───────────────────────────────────────────┘  │  │  │  │
│  │  │  └─────────────────────────────────────────────────┘  │  │  │
│  │  └───────────────────────────────────────────────────────┘  │  │
│  └─────────────────────────────────────────────────────────────┘  │
│                                                                   │
│  ┌──────────────────┐    ┌──────────────────┐                     │
│  │  S3 (config      │    │  S3 (data        │                     │
│  │  asset)          │    │  bucket)         │                     │
│  │  config.toml     │    │  /home/agent     │                     │
│  └──────────────────┘    └──────────────────┘                     │
└───────────────────────────────────────────────────────────────────┘
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,
  dataS3Prefix: 'my-agent-data',
  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
dataBucket s3.IBucket 自動建立 持久化資料用的 S3 bucket
dataS3Prefix string agent-data S3 資料前綴
dataLocalPath string /home/agent 資料掛載路徑
configPath string 必填 本地 config.toml 路徑,透過 S3 init container 掛載到 /etc/agent-broker/config.toml
Exposed Resources

AgentBroker construct 暴露以下屬性,方便後續串接:

  • broker.vpc — VPC
  • broker.cluster — ECS Cluster
  • broker.service — Fargate Service
  • broker.dataBucket — 持久化資料 S3 Bucket
Container Flow
  1. data-init (init container):從 S3 data bucket 還原 /home/agent 資料,並從 S3 asset 下載 config.toml
  2. app:主應用容器,等待 init 完成後啟動,掛載資料目錄(read-write)和 config(read-only)
  3. data-backup (sidecar):每 10 分鐘定期將 /home/agent sync 到 S3 data bucket,並在收到 SIGTERM(app 停止)時執行最後一次備份

Metadata

Release files for cdk-agent-broker 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdk-agent-broker 0.0.3
File Size Uploaded Provenance
cdk_agent_broker-0.0.3.tar.gz 40.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cdk-agent-broker 0.0.3
File Interpreter ABI Platform
cdk_agent_broker-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 80.4 kB

Release files / cdk_agent_broker-0.0.3.tar.gz

Download URL cdk_agent_broker-0.0.3.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3845ce50fd18ccade2f68c13f98a7660b147eaa2d66749bb1b152811e55b45f0
BLAKE2b-256 checksum
How to use checksums
81742c54df053880398bfd5b3ce2e83e33ef9e6c7226c5e29444e08f5e11db7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.14.3

Release files / cdk_agent_broker-0.0.3-py3-none-any.whl

Download URL cdk_agent_broker-0.0.3-py3-none-any.whl
Size 39.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
095ccfef1dc8debf23beb2313010c379dbfa92ab60a098da2b5f518ec7a3fc51
BLAKE2b-256 checksum
How to use checksums
816b388f06e9a77823f778878b7f4515256261ff232e20da1e9145c528e854a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.14.3

Security for cdk-agent-broker 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page