TECHNOLOGY

Migrate a Sonar integration by comparing request and response shapes

In this article
THE QUICK TAKE

Preserve the old application's decisions through explicit request and response mappings; a successful connection does not prove the migrated consumer understands the new run.

A Sonar-era integration may assume messages in, one answer string out, and citations in a familiar location. The current Agent API has a richer run structure. Migration should preserve the application’s useful behavior while replacing assumptions that no longer describe its request or response.

Map the request deliberately

The migration guide maps messages to input, with instructions or input items carrying standing guidance. A simple string can represent a simple turn, but flattening a conversation loses role boundaries and tool observations. Identify which parts of the old transcript the next turn actually needs.

Replace the output parser

Answer text is available through output_text, while typed output items carry more than prose. The compatibility guide explains the current surface. Branch on item type for sources and tool work. Preserve source identifiers rather than assuming their array positions reproduce the old citation numbering.

Update streaming separately

The migration guide distinguishes legacy content deltas from typed Agent events such as response.output_text.delta. Tool and reasoning events are not answer fragments. An old stream concatenator can therefore display internal structures or miss the answer. Treat stream completion and the final collected result as explicit states in the consumer.

Preserve continuation ownership

The conversation-state guide documents replaying input or using previous_response_id for a completed response. Choose one intended continuation strategy and retain its identifiers. Copying only the visible final answer can discard context necessary to interpret a later question or tool result.

Test the migrated decision paths

Use a normal grounded answer, a follow-up, and a run with non-message output. Compare supported fields and user-visible behavior rather than exact prose. The article on deprecation migration explains preserving consumers. The guide to terminal stream handling helps distinguish an ended connection from a completed result. Migration is complete when these paths work under the new contract, not when authentication alone succeeds.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles