Skip to content

Upgrading to 1.9.0

Railtracks 1.9.0 lets a message mix text and attachments in any order, such as "this chart, then that chart". To support that, every message follows one rule: .content is a list of parts, in order. A part is text (str), an Attachment, or, on an assistant turn, a ToolCall. Structured output does not change: an agent with an output_schema still returns your pydantic model.

1.9.0 is a minor release with a breaking change

Version pins such as railtracks>=1.8 or railtracks~=1.8 will pick up 1.9.0 automatically. If you are not ready to migrate, pin railtracks==<YOUR VERSION>.

Railtracks 1.8.2 emits a FutureWarning each time your code reads .content on a message or on a text agent's result. FutureWarning is shown by default, and each warning names the line that read .content and what to read instead. Reads that railtracks makes itself, and reads of structured output, never warn.


Changes you can make today

Everything in this section works in both 1.8.2 and 1.9.0. Migrate now and the upgrade is a no-op.

Instead of Read Gives
result.content on a text agent result.text The reply, as a str
message.content on a user, assistant or system message message.text The message's text, as a str
message.attachment message.attachments The attachments, as a list that is empty when there are none
isinstance(message.content, ToolCalls) if message.tool_calls: The calls a model made, empty for any other turn
message.content.text on a tool-calling turn message.text The text the model spoke alongside its calls
message.content.result on a tool message message.text The tool's result, as a str
message.content.identifier on a tool message message.tool_call_id The call this result answers
message.content.name on a tool message message.name The tool that produced the result

.text is "" for structured output. On an agent result, .text raises TypeError for structured output; keep reading result.structured there.

Read results with .text

# before
result = flow.invoke("What's the weather in Paris?")
print(result.content)

# after
print(result.text)

The same applies when one agent's answer feeds another: rt.call(next_agent, result.text).

Replace isinstance checks on .content

This is the pattern most likely to break quietly. In 1.9.0, isinstance(message.content, str) is always false, so code behind it stops running without raising: a custom guard that scanned for a keyword would allow everything.

# before
@rt.input_guard
def block_passwords(event):
    for message in event.messages:
        if isinstance(message.content, str) and "password" in message.content.lower():
            return rt.guardrails.GuardrailDecision.block(reason="No passwords.")
    return rt.guardrails.GuardrailDecision.allow()

# after
@rt.input_guard
def block_passwords(event):
    for message in event.messages:
        if "password" in message.text.lower():
            return rt.guardrails.GuardrailDecision.block(reason="No passwords.")
    return rt.guardrails.GuardrailDecision.allow()

Search your code for isinstance( next to .content, and for .content used as a string (.lower(), in, +, slicing, re.search).

Tool-calling turns and tool results

# before
if isinstance(message.content, ToolCalls):
    spoken = message.content.text
    for call in message.content:
        print(call.name, call.arguments)

# after
if message.tool_calls:
    spoken = message.text
    for call in message.tool_calls:
        print(call.name, call.arguments)
# before
print(message.content.result, message.content.identifier, message.content.name)

# after
print(message.text, message.tool_call_id, message.name)

What changes in 1.9.0

Reading 1.8 1.9.0
UserMessage("Hi").content "Hi" ["Hi"]
UserMessage("Look", attachment="a.png").content "Look", with the image on .attachment ["Look", Attachment(...)]
AssistantMessage("Hi").content "Hi" ["Hi"]
SystemMessage("Be brief.").content "Be brief." ["Be brief."]
result.content for a text agent "Hi" ["Hi"]
A tool-calling turn's .content ToolCalls([call], text="Checking.") ["Checking.", call]
A tool result's .content ToolResponse(identifier="c1", name="weather", result="18°C") ["18°C"]

Creating messages does not change: UserMessage("Hi"), AssistantMessage("Hi"), SystemMessage("Be brief."), attachment= and rt.call(agent, "Hi") still take a string.

1.9.0 also adds new ways to build tool messages and tool-calling turns, ToolMessage("18°C", tool_call_id="c1", name="get_weather") and AssistantMessage(["Checking.", call]). The current forms, ToolMessage(ToolResponse(...)) and AssistantMessage(ToolCalls(...)), keep working in 1.9.0 with a DeprecationWarning, as do ToolMessage.result, ToolMessage.identifier and UserMessage.attachment.


Silencing the warning

Migrating is the way to clear the warning. If you cannot migrate yet, filter it by its message:

import warnings

warnings.filterwarnings(
    "ignore", message=r".*\.content becomes a list of parts", category=FutureWarning
)