Skip to main content

Python DSL for Amazon Connect contact flow generation

Project description

CxBlueprint

CI codecov PyPI Python

Programmatic Amazon Connect contact flow generation using Python. Lets AI models and developers build contact flows from plain English instead of hand-writing JSON.

23 of 54 AWS Connect block types supported (43%) — covers all common IVR, routing, A/B testing, and queue transfer patterns. Includes an MCP server for AI-assisted flow generation with Claude Desktop, Cursor, and VS Code.

Simple Example

from cxblueprint import Flow

flow = Flow.build("Burger Order")

welcome = flow.play_prompt("Welcome to Burger Palace!")
menu = flow.get_input("Press 1 for Classic Burger or 2 for Veggie Burger", timeout=10)
welcome.then(menu)

classic = flow.play_prompt("You selected Classic Burger. Your order is confirmed!")
veggie = flow.play_prompt("You selected Veggie Burger. Your order is confirmed!")
error_msg = flow.play_prompt("Invalid selection. Goodbye.")

disconnect = flow.disconnect()

menu.when("1", classic) \
    .when("2", veggie) \
    .otherwise(error_msg) \
    .on_error("InputTimeLimitExceeded", error_msg) \
    .on_error("NoMatchingCondition", error_msg) \
    .on_error("NoMatchingError", error_msg)

classic.then(disconnect)
veggie.then(disconnect)
error_msg.then(disconnect)

flow.compile_to_file("burger_order.json")

Terraform Template Example

Use placeholders for dynamic resource ARNs:

from cxblueprint import Flow

flow = Flow.build("Counter Flow")

welcome = flow.play_prompt("Thank you for calling!")
invoke_counter = flow.invoke_lambda(
    function_arn="${COUNTER_LAMBDA_ARN}",  # Resolved by Terraform
    timeout_seconds="8"
)
welcome.then(invoke_counter)

say_count = flow.play_prompt("You are caller number $.External.count")
invoke_counter.then(say_count)

disconnect = flow.disconnect()
say_count.then(disconnect)
invoke_counter.on_error("NoMatchingError", disconnect)

flow.compile_to_file("counter_flow.json")

Generated Flow Examples

Here's what the generated flows look like in the Amazon Connect console:

Example Generated Flow

Example Generated Flow 2

Installation

pip install cxblueprint

# With MCP server for AI integration
pip install cxblueprint[mcp]

MCP Server

CxBlueprint includes an MCP server that lets AI tools (Claude Desktop, Cursor, VS Code) build contact flows conversationally.

Configure Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "cxblueprint": {
      "command": "cxblueprint-mcp"
    }
  }
}

Then ask Claude: "Build me an IVR with a welcome message and 3 menu options for sales, support, and billing"

The AI reads the bundled documentation automatically and uses the compile_flow tool to generate valid Amazon Connect JSON.

Block Coverage

23 / 54 block types implemented (43%)

Category Implemented Total Coverage
Participant Actions 6 6 100%
Contact Actions 8 25 32%
Flow Control Actions 7 15 47%
Interactions 2 8 25%

See each category's README for the full per-block breakdown.

Features

  • Fluent Python API for building flows
  • MCP server for AI-assisted flow generation
  • Canvas layout positioning for AWS Connect visual editor
  • Automatic UUID generation for blocks
  • Conditional branching and error handling
  • AWS Lambda and Lex V2 bot integration
  • Template placeholder support for Terraform/IaC
  • Decompile existing flows back to Python

Project Structure

src/cxblueprint/
  flow_builder.py       # Main builder API
  flow_analyzer.py      # Flow validation
  mcp_server.py         # MCP server for AI integration
  blocks/               # All Connect block types
examples/               # Sample flows
docs/                   # API reference & AI instructions

Documentation

Requirements

  • Python 3.11+
  • AWS credentials (for deployment)
  • Terraform (optional, for infrastructure)

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

cxblueprint-0.1.0.post8.tar.gz (484.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cxblueprint-0.1.0.post8-py3-none-any.whl (70.9 kB view details)

Uploaded Python 3

File details

Details for the file cxblueprint-0.1.0.post8.tar.gz.

File metadata

  • Download URL: cxblueprint-0.1.0.post8.tar.gz
  • Upload date:
  • Size: 484.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cxblueprint-0.1.0.post8.tar.gz
Algorithm Hash digest
SHA256 3451ed382a813410ca97ac566ca835435cc1766d19a4b9b8aa84ce362b793c00
MD5 6278b6217a963ca7d52320feb7491dc7
BLAKE2b-256 b209ec31b80e9e1c688d35997cf757e82a1906cfcac45370b8f48d7eeee8c1d1

See more details on using hashes here.

File details

Details for the file cxblueprint-0.1.0.post8-py3-none-any.whl.

File metadata

File hashes

Hashes for cxblueprint-0.1.0.post8-py3-none-any.whl
Algorithm Hash digest
SHA256 786e282cf9c8f003a9e9a58106bde0c2dc768aeb39c90baa3d57018cb542f35f
MD5 0947f411c6c9f0354a95712dbf95174a
BLAKE2b-256 f3006ad3728d1de5793382c52c72cad05d1f16fda474403f2a17c2658c377acf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page