Skip to main content

CxBlueprint

CI 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.

All 56 AWS Connect block types supported (100%) — complete coverage of IVR, routing, A/B testing, queue transfer, customer profiles, case management, Voice ID, and analytics 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

56 / 56 block types implemented (100%)

Category Implemented Total Coverage
Participant Actions 6 6 100%
Contact Actions 27 27 100%
Flow Control Actions 16 16 100%
Interactions 8 8 100%

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)

Release files for cxblueprint 0.1.0.post11

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

Source distribution (sdist)

Source distribution for cxblueprint 0.1.0.post11
File Size Uploaded
cxblueprint-0.1.0.post11.tar.gz 501.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cxblueprint 0.1.0.post11
File Interpreter ABI Platform
cxblueprint-0.1.0.post11-py3-none-any.whl Python 3 none any Details

Total release size: 610.8 kB

Release files / cxblueprint-0.1.0.post11.tar.gz

Download URL cxblueprint-0.1.0.post11.tar.gz
Size 501.4 kB
Tags Source
SHA-256 checksum
How to use checksums
413a38de565af7ecfeacd23980360368cd62eab60eab4e0e99b043134a7c0fbe
BLAKE2b-256 checksum
How to use checksums
dd1d65a59d8b2dbc869d275d7d9a88f897a6da15d79e1870ac542c8e58815985
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cxblueprint-0.1.0.post11-py3-none-any.whl

Download URL cxblueprint-0.1.0.post11-py3-none-any.whl
Size 109.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b1a7c64142440efce7f490cde8fca38c2d666d9d310aef5f39a7a51210110bd
BLAKE2b-256 checksum
How to use checksums
d09f1d4eecc44d15e108ae8ee81443a03a1fea04200725d702e0ba59a9dddde8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7
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