Diagrid
Back to Getting Started & Migration
Getting Started & Migration

What pattern should I follow to wrap existing agent logic in durable steps without altering the core business logic or its unit tests?

Use an adapter function that receives the existing agent’s input, calls the original logic, and returns its output, while Catalyst manages the durable lifecycle around it. This thin wrapper keeps business code untouched, so existing tests remain valid. Add separate tests for the wrapper’s integration with Catalyst. Beware that if the original logic has hidden non-determinism (e.g., direct LLM calls with timestamps), the replay may diverge, requiring you to refactor those calls into idempotent steps.

Was this article helpful?

Your feedback helps improve Diagrid's FAQ experience.

Keep reading

More Diagrid FAQ articles

View all