Available models
Writer offers several specialized Palmyra models:
See the Writer models guide for more details and use cases.
The above Bedrock models IDs for Palmyra X5 and Palmyra X4 are using cross-region inference profiles. Check which AWS Regions support Writer models before selecting an inference profile.
Prerequisites
Before you begin, make sure you have:- Python 3.10 or higher installed
- Basic familiarity with Python and AWS Strands
Writer API configuration
Prerequisites
Before you configure the WRITER API client for Strands Agent SDK, make sure you have:- A Writer AI Studio account
- A Writer API key. See instructions in the API Quickstart
Installation
To use Writer models with Strands Agents, install the optional Writer dependency:To follow along with the examples in this guide, you’ll also need the Strands Agent Tools package. Install the package with
pip install strands-agents-tools.Client configuration
You can pass additional arguments to the Writer client viaclient_args:
Environment variables
You can set your Writer API key as an environment variable instead of passing it directly:client_args["api_key"] parameter:
Usage
After installing, you can import and initialize the Writer provider in Strands Agents:By default, Strands Agents use a
PrintingCallbackHandler that streams responses to stdout as they’re generated. When you call agent("What is 2+2"), you’ll see the response appear in real-time as it’s being generated. The print(response) above also shows the final collected result after the response is complete. See Callback Handlers in the Strands documentation for more details.Amazon Bedrock configuration
You can also use Writer models through Amazon Bedrock, which provides a managed service for accessing foundation models.Prerequisites
Before you configure the Amazon Bedrock client for Strands Agent SDK, follow the Bedrock integration guide to set up AWS credentials, enable Writer models in your region, and set up the required IAM permissions.Installation
Install the base Strands Agents package:BedrockModel class is available by default.
To follow along with the examples in this guide, you’ll also need the Strands Agent Tools package. Install the package with
pip install strands-agent-tools.
To follow along with the examples in this guide, you’ll also need the Strands Agent Tools package. Install the package with pip install strands-agents-tools.Client configuration
The following client configuration uses theus.writer.palmyra-x5-v1:0 model ID, which is the ID for the cross-region inference profile for Palmyra X5. Check which AWS Regions support Writer models before selecting an inference profile.
Usage
After configuring the Bedrock model, you can use it with Strands Agents:Model configuration
TheWriterModel accepts configuration parameters as keyword arguments to the model constructor:
Examples
Writer API integration
Enterprise workflow automation
The
web_search and email_sender tools in this example are custom tools that you would need to define. See Python Tools for guidance on creating custom tools, or use existing tools from the strands_tools package.Financial analysis with Palmyra Fin
Long-context document processing
Vision and image analysis
Palmyra X5 supports vision capabilities, allowing you to analyze images and extract information from visual content.Bedrock integration
Structured output generation
Palmyra X5 and X4 support structured output generation using Pydantic models through Bedrock. This is useful for ensuring consistent, validated responses.Structured output disables streaming and returns the complete response at once, unlike regular chat completions, which stream by default. See Callback Handlers for more details.
Memory agent
This example demonstrates how to use Writer models through Bedrock with memory capabilities. Themem0_memory tool from strands_tools provides persistent, long-term memory that stores information using Mem0’s memory architecture, allowing the agent to remember user preferences, facts, and context across multiple sessions. The memory system uses semantic search to retrieve relevant information and can store, list, and retrieve memories based on user queries.