Skip to content
Inline code nodes now supported in Amazon Bedrock Flows in public preview
Source: aws.amazon.com

Inline code nodes now supported in Amazon Bedrock Flows in public preview

Sources: https://aws.amazon.com/blogs/machine-learning/inline-code-nodes-now-supported-in-amazon-bedrock-flows-in-public-preview

TL;DR

  • Inline code nodes let you write Python scripts directly inside Amazon Bedrock Flows, removing the need for separate AWS Lambda functions for simple logic.
  • Public preview is available in US East (N. Virginia, Ohio), US West (Oregon), and Europe (Frankfurt).
  • The feature includes a Python code editor with templates and supports workflows that include preprocessing and postprocessing steps.
  • Traces can be enabled to Amazon CloudWatch via the API (invoke flow with enableTrace = true), providing detailed execution insights.
  • This capability aims to democratize generative AI development and reduce maintenance overhead, accelerating enterprise adoption of Bedrock Flows. AWS notes in their blog post that inline code nodes allow writing Python scripts directly within Bedrock Flows, streamlining preprocessing and postprocessing tasks and reducing the need for separate Lambda functions. See the linked post for full details: Inline code nodes now supported in Amazon Bedrock Flows in public preview.

Context and background

Amazon Bedrock Flows is a capability for designing and deploying workflows that build generative AI applications entirely within the Amazon Bedrock environment. The public preview of inline code nodes introduces a new node type that enables writing Python code directly in the flow, addressing a common need to perform simple preprocessing and postprocessing without wiring up additional Lambda functions. This enhancement aligns with enterprise needs to simplify AI workflow development, reduce infrastructure management, and lower adoption barriers for generative AI solutions. The blog post emphasizes that inline code nodes streamline tasks such as data normalization and response formatting, making it easier to iterate on AI applications while maintaining governance and safety within Bedrock Flows. The article also notes that Bedrock Flows is now generally available with enhanced safety and traceability, further underscoring the platform’s maturation. In the real-world example described in the post, Thomson Reuters demonstrates a multi-step use case that benefits from inline code, handling simple preprocessing and postprocessing as part of a single flow. The example workflow centers on processing user requests for music playlists, incorporating both preprocessing and postprocessing inline code nodes to validate data and format responses.

What’s new

This release introduces inline code support in Bedrock Flows, allowing Python scripts to run inside a flow without requiring separate Lambda functions for basic logic. The inline code node appears as a new option in the Nodes tab of the Bedrock Flows editor, and it provides a Python code editor along with sample templates to help developers get started. In the sample described in the blog, two inline code nodes are used within the flow to handle preprocessing and postprocessing tasks. Key technical notes include:

  • Input to an inline code node is treated as untrusted user input; developers should implement appropriate parsing, validation, and data handling within the Python code.
  • The flow editor provides execution traces, which give insights into each processing step and help identify issues during execution. You can enable traces via the API and send them to Amazon CloudWatch logs by setting enableTrace to true in an InvokeFlow request. Each flowOutputEvent is returned alongside a flowTraceEvent in the response.
  • The article demonstrates how to create a simple Bedrock flow using an inline code node and shows how to run and programmatically execute the flow via Bedrock APIs.
  • Regions where inline code nodes are available in public preview include US East (N. Virginia, Ohio), US West (Oregon), and Europe (Frankfurt).

Implementation notes and example workflow

The post walks through building a flow with an inline code node instead of a Lambda function for custom logic in a generative AI-powered application. It highlights that the inline code node is accessible from the Nodes tab, with a Python editor and code templates ready for use. The Thomson Reuters example illustrates a practical use case where inline code nodes perform input validation and response formatting for a music playlist request. To get started, you can open the Amazon Bedrock console or Bedrock APIs and begin building flows with Bedrock Flows today. The article points to additional resources to configure flows with enhanced safety and traceability.

Why it matters (impact for developers/enterprises)

Allowing inline code execution inside Bedrock Flows reduces the need to create and maintain separate Lambda functions for straightforward preprocessing and postprocessing tasks. This lowers the barrier to entry for organizations adopting generative AI by simplifying workflow design and deployment, and it minimizes the overhead of managing additional infrastructure. By enabling in-situ data validation, transformation, and formatting, inline code nodes help teams iterate more quickly on AI-powered applications while keeping the entire workflow contained within Bedrock. As Bedrock Flows expands its capabilities, developers can focus more on building sophisticated AI workflows and less on wiring together disparate services. The public preview brings this capability to multiple regions, broadening access for enterprises planning global AI initiatives. The broader goal highlighted by AWS is to democratize generative AI development and accelerate enterprise adoption, aligning with customer needs for a streamlined development experience and robust traceability.

Technical details or Implementation (how to use)

  • Open the Amazon Bedrock console or Bedrock APIs and create a flow.
  • In the flow editor, add an Inline Code node (new node type available on the Nodes tab).
  • Use the Python code editor and templates to write your inline logic for preprocessing or postprocessing tasks.
  • Treat all input to the inline code node as untrusted and implement validation and safe parsing inside your Python function.
  • For observability, enable traces by calling the API with enableTrace set to true in an InvokeFlow request. View the resulting flowTraceEvent alongside each flowOutputEvent, and send traces to CloudWatch if desired.
  • You can build flows with multiple inline code nodes (the example in the post uses two nodes for preprocessing and postprocessing).
  • Availability: inline code nodes are in public preview in US East (N. Virginia, Ohio), US West (Oregon), and Europe (Frankfurt).

Availability and regions

RegionAvailability
US East (N. Virginia, Ohio)Public preview
US West (Oregon)Public preview
Europe (Frankfurt)Public preview

Key takeaways

  • Inline code nodes let you run Python directly inside Bedrock Flows, reducing reliance on Lambda for simple logic.
  • The public preview brings Python editing, templates, and multi-node flows within Bedrock Flows.
  • Tracing and CloudWatch integration provide observability for flow execution and debugging.
  • The feature is designed to improve adoption and accelerate iteration cycles for enterprise AI applications.
  • Regions in public preview include US East, US West, and Europe, with setup via Bedrock Console or Bedrock APIs.

FAQ

  • What are inline code nodes?

    Inline code nodes are a new Bedrock Flows feature that lets you write Python scripts inside a flow to perform simple preprocessing and postprocessing without separate Lambda functions.

  • Do I still need Lambda functions for simple logic?

    Inline code nodes provide an in-flow alternative for straightforward logic, reducing the need to create separate Lambda functions for basic processing tasks.

  • How do I enable tracing for flows?

    In the InvokeFlow API, set enableTrace to true to generate flowTraceEvent data and output it alongside flowOutputEvent; traces can be sent to CloudWatch for real-time insights.

  • Where is this feature available?

    Inline code nodes are in public preview in US East (N. Virginia, Ohio), US West (Oregon), and Europe (Frankfurt).

  • Where can I learn more or provide feedback?

    You can refer to the AWS Bedrock blog post announcing the feature, and AWS channels such as re:Post and community forums for feedback.

References

More news