Skip to main content

Agent Formations

Agent Formations is a CloudFormation-inspired declarative deployment layer that lets you describe an entire AI agent stack in a single JSON/YAML template and deploy it with one API call. SOAT resolves resource dependencies automatically, provisions resources in the correct order, and tracks every change in an immutable event log.

Note: Creating a formation also creates underlying resources (agents, memories, etc.). The calling identity must also have the relevant agents:CreateAgent, memories:CreateMemory, etc. permissions.

Overview

Instead of making a dozen separate API calls to create an AI provider, memory, agent tool, and agent, you write a single template:

{
"resources": {
"MyProvider": {
"type": "ai_provider",
"properties": {
"name": "My OpenAI",
"provider": "openai",
"default_model": "gpt-4o"
}
},
"MyMemory": {
"type": "memory",
"properties": {
"name": "Product KB"
}
},
"MyAgent": {
"type": "agent",
"properties": {
"name": "Support Bot",
"ai_provider_id": { "ref": "MyProvider" },
"knowledge_config": {
"memory_ids": [{ "ref": "MyMemory" }]
}
}
}
},
"outputs": {
"agentId": { "ref": "MyAgent" }
}
}

SOAT detects that MyAgent depends on MyProvider and MyMemory through the ref expressions, creates them first, then creates the agent with the resolved physical IDs.

Key Concepts

Formation Template

A template has three top-level keys:

KeyRequiredDescription
resourcesYesMap of logical resource ID → resource declaration
outputsNoMap of output names → values (may contain ref expressions)
metadataNoArbitrary metadata stored with the formation

Resource Declaration

{
"type": "agent",
"properties": { ... },
"depends_on": ["OtherLogicalId"],
"metadata": { }
}
  • type — one of: ai_provider, agent_tool, agent, document, memory, memory_entry, webhook
  • properties — resource-specific properties (snake_case, matching the REST API body fields)
  • depends_on — explicit dependency list in addition to implicit ref dependencies
  • metadata — arbitrary key/value stored on the resource record

Ref Expressions

Use { "ref": "LogicalId" } anywhere in a properties value (or in outputs) to substitute the physical public ID of another resource once it is created:

"ai_provider_id": { "ref": "MyProvider" }

Refs create implicit dependencies — no need to repeat them in depends_on.

Topological Ordering

SOAT builds a dependency graph from both explicit depends_on entries and implicit ref expressions, then uses topological sort (Kahn's algorithm) to determine the creation order. A template with a cycle fails validation.

Resource Lifecycle

Each resource in a formation goes through these statuses:

StatusMeaning
pendingNot yet provisioned
createdSuccessfully created by a formation deploy
updatedSuccessfully updated by a subsequent deploy
deletedDeleted when removed from the template
failedLast operation failed

The formation stack itself has these statuses:

StatusMeaning
creatingFirst deployment in progress
activeAll resources provisioned successfully
updatingA template update is in progress
failedLast deployment ended with one or more resource failures
deletingStack teardown in progress
deletedAll resources removed
delete_failedStack teardown encountered failures

Operations and Event Log

Every deploy (create, update, delete) creates a FormationOperation record with:

  • operation_typecreate | update | delete
  • statuspending | running | succeeded | failed
  • plan — the planned changes computed before execution
  • events — ordered list of per-resource events with timestamp, action, status, and error (if any)

Use GET /api/v1/agent-formations/{formation_id}/events to retrieve the full history.

Data Model

AgentFormation

FieldTypeDescription
idstringPublic ID (af_…)
project_idstringProject public ID
namestringFormation name (unique per project)
templateobjectThe last applied template
outputsobjectResolved output values
statusstringFormation status
metadataobjectArbitrary metadata
resourcesarrayResources managed by the formation
created_atdatetime
updated_atdatetime

AgentFormationResource

FieldTypeDescription
idstringPublic ID (afr_…)
logical_idstringLogical ID from the template
resource_typestringResource type
physical_resource_idstringPublic ID of the physical SOAT resource
statusstringResource status

FormationOperation

| Field | Type | Description | | ---------------- | -------- | --------------------------------- | ------ | ------- | | id | string | Public ID (afo_…) | | operation_type | string | create | update | delete | | status | string | Operation status | | plan | object | Planned changes | | events | array | Per-resource event log | | error | object | Error details if operation failed | | created_at | datetime | | | updated_at | datetime | |