VirtuousAI

Crystallization

Turn ad-hoc AI work into deterministic, repeatable automations

Crystallization

Crystallization converts successful agent runs or chat threads into deterministic automation DAGs. What starts as exploratory AI work becomes a reliable, repeatable pipeline.

The Problem

AI chat is powerful but ephemeral. If an agent successfully builds a report by running five tools in sequence — querying data, transforming results, building a flashboard — you want to capture that workflow and run it again tomorrow without AI interpretation overhead.

ApproachTrade-off
Re-run the same chat promptNon-deterministic; AI may choose different tools or parameters
Manually build an automationTime-consuming; error-prone to reconstruct from memory
Crystallize the runDeterministic; captures exact steps, parameters, and order

How It Works

Two Sources

Crystallization works from two sources:

SourceEndpointWhen to Use
Agent runsPOST /api/v1/agents/runs/{run_id}/crystallizeAfter a successful agent execution
Chat threadsPOST /api/v1/chat/threads/{thread_id}/crystallizeAfter a chat conversation with completed actions

What Gets Captured

The crystallization process extracts every tool call from the run and converts it into an automation step:

SourceCaptured AsResult
Tool callsDAG stepsEach tool call becomes an automation step with its action kind
ParametersStep inputsResolved values are frozen as step configuration
Execution orderDependenciesSteps maintain the same execution sequence
Approval gatesapproval_gate stepsHuman oversight is preserved where needed

Example

An agent run that:

  1. Called generate_query to get revenue data
  2. Called generate_query to get order counts
  3. Called create_flashboard to build a dashboard

Becomes an automation with three steps in sequence, each with the exact parameters used during the original run.

Non-deterministic steps (like generate_query where the SQL is AI-generated) are flagged in the automation metadata. You can review and edit the frozen parameters before activating the automation.

Crystallized Automations

The output is a standard automation with source_type=CRYSTALLIZED. It has all the capabilities of any other automation:

FeatureAvailable
Triggers (schedule, webhook, event)Yes
Monitoring and run historyYes
VersioningYes
Editing stepsYes
Adding/removing stepsYes
Conditional branchingYes

The only difference is the source_type field, which records where the automation originated:

Source TypeOrigin
MANUALCreated directly via API or UI
CRYSTALLIZEDExtracted from an agent run or chat thread

Crystallized automations are fully editable. You can modify steps, add triggers, adjust conditions, or extend the workflow after creation.

When to Crystallize

ScenarioRecommendation
Successful multi-step workflow you'll repeatCrystallize
Stable data pipeline (extract, transform, visualize)Crystallize
One-off exploratory analysisSkip
Workflow still being iterated onWait until stable
Simple single-tool operationLikely overkill

Learn More

On this page