Available models
Writer offers several specialized Palmyra models:Model | Model ID (Writer API) | Model ID (Bedrock) | Context Window | Availability | Description |
---|---|---|---|---|---|
Palmyra X5 | palmyra-x5 | us.writer.palmyra-x5-v1:0 | 1M tokens | Writer API or Amazon Bedrock | Latest model with 1 million token context for complex workflows, supports vision and multi-content |
Palmyra X4 | palmyra-x4 | us.writer.palmyra-x4-v1:0 | 128k tokens | Writer API or Amazon Bedrock | Advanced model for workflow automation and tool calling |
Palmyra Fin | palmyra-fin | Not available | 128k tokens | Writer API only | Finance-specialized model |
Palmyra Med | palmyra-med | Not available | 32k tokens | Writer API only | Healthcare-specialized model for medical analysis |
Palmyra Creative | palmyra-creative | Not available | 128k tokens | Writer API only | Creative writing and brainstorming model |
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:
Parameter | Type | Description | Default | Options |
---|---|---|---|---|
model_id | str | Model name to use (palmyra-x5 , palmyra-x4 , etc.) | Required | reference |
max_tokens | Optional[int] | Maximum number of tokens to generate | See the Context Window for each available model | reference |
stop | Optional[Union[str, List[str]]] | A token or sequence of tokens that, when generated, causes the model to stop producing further content. This can be a single token or an array of tokens, acting as a signal to end the output. | None | reference |
stream_options | Dict[str, Any] | Additional options for streaming. Specify include_usage to include usage information in the response, in the accumulated_usage field. If you don’t specify this, accumulated_usage for each value. | None | reference |
temperature | Optional[float] | What sampling temperature to use (0.0 to 2.0). A higher temperature produces more random output. | 1 | reference |
top_p | Optional[float] | Threshold for “nucleus sampling” | None | reference |
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.