Skip to content

Deploy: Protocol

Deploy adapters communicate with the CLI using JSON-RPC 2.0 over stdio (stdin/stdout). This page documents the wire protocol, including all methods, request/response formats, and error codes.

  • Input: Line-delimited JSON on stdin
  • Output: Line-delimited JSON on stdout
  • Encoding: UTF-8
  • Max line size: 10 MB
  • Initial buffer: 64 KB

Each JSON-RPC message is a single line terminated by \n. The CLI sends requests and reads responses sequentially.

All messages follow the JSON-RPC 2.0 specification.

{
"jsonrpc": "2.0",
"id": 1,
"method": "plan",
"params": { ... }
}
{
"jsonrpc": "2.0",
"id": 1,
"result": { ... }
}
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32603,
"message": "provider error: resource creation failed"
}
}

Returns adapter metadata.

Request:

{
"jsonrpc": "2.0",
"id": 1,
"method": "get_provider_info",
"params": {}
}

Response:

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"name": "agentcore",
"version": "0.2.0",
"capabilities": ["a2a", "bedrock"],
"config_schema": "{ ... JSON Schema ... }"
}
}
FieldTypeRequiredDescription
namestringYesProvider name
versionstringYesAdapter version
capabilitiesstring[]NoList of capabilities
config_schemastringNoJSON Schema for config validation

Validates provider configuration before planning.

Request:

{
"jsonrpc": "2.0",
"id": 2,
"method": "validate_config",
"params": {
"config": "{\"region\":\"us-west-2\"}"
}
}

Response (valid):

{
"jsonrpc": "2.0",
"id": 2,
"result": {
"valid": true
}
}

Response (invalid):

{
"jsonrpc": "2.0",
"id": 2,
"result": {
"valid": false,
"errors": [
"region 'invalid' is not supported",
"account_id is required"
]
}
}
ParamTypeDescription
configstringJSON-encoded provider config
Result FieldTypeDescription
validboolWhether config is valid
errorsstring[]Validation error messages

Analyzes the pack and config to determine what resources need to change.

Request:

{
"jsonrpc": "2.0",
"id": 3,
"method": "plan",
"params": {
"pack_json": "{ ... serialized pack ... }",
"deploy_config": "{\"region\":\"us-west-2\"}",
"environment": "production",
"prior_state": "eyJyZXNvdXJjZV9pZCI6ImFiYzEyMyJ9"
}
}

Response:

{
"jsonrpc": "2.0",
"id": 3,
"result": {
"changes": [
{
"type": "agent_runtime",
"name": "greeting",
"action": "CREATE",
"detail": "Create agent runtime for greeting prompt"
},
{
"type": "a2a_endpoint",
"name": "greeting",
"action": "UPDATE",
"detail": "Update endpoint configuration"
}
],
"summary": "1 to create, 1 to update"
}
}
ParamTypeDescription
pack_jsonstringSerialized .pack.json contents
deploy_configstringJSON-encoded merged provider config
environmentstringTarget environment name
prior_statestringOpaque adapter state from prior deploy (empty if first deploy)
Result FieldTypeDescription
changesResourceChange[]List of planned resource changes
summarystringHuman-readable summary

ResourceChange:

FieldTypeDescription
typestringResource type (e.g., "agent_runtime")
namestringResource name
actionstring"CREATE", "UPDATE", "DELETE", "DRIFT", or "NO_CHANGE"
detailstringHuman-readable description

Executes the deployment plan, creating/updating/deleting resources.

Request:

{
"jsonrpc": "2.0",
"id": 4,
"method": "apply",
"params": {
"pack_json": "{ ... serialized pack ... }",
"deploy_config": "{\"region\":\"us-west-2\"}",
"environment": "production",
"prior_state": ""
}
}

Response:

{
"jsonrpc": "2.0",
"id": 4,
"result": {
"state": "eyJydW50aW1lX2lkIjoiYWJjMTIzIn0=",
"events": [
{
"type": "progress",
"message": "Creating runtime... (25%)"
},
{
"type": "resource",
"resource": {
"type": "agent_runtime",
"name": "greeting",
"action": "CREATE",
"status": "created"
}
},
{
"type": "complete",
"message": "Deployment complete"
}
]
}
}
ParamTypeDescription
pack_jsonstringSerialized .pack.json contents
deploy_configstringJSON-encoded merged provider config
environmentstringTarget environment name
prior_statestringOpaque adapter state (empty if first deploy)
Result FieldTypeDescription
statestringOpaque adapter state to persist
eventsApplyEvent[]Progress events from the apply

ApplyEvent:

FieldTypeDescription
typestring"progress", "resource", "error", or "complete"
messagestringHuman-readable message
resourceResourceResultResource operation result (for "resource" type)

ResourceResult:

FieldTypeDescription
typestringResource type
namestringResource name
actionstringApplied action
statusstring"created", "updated", "deleted", or "failed"
detailstringAdditional info

Tears down all managed resources.

Request:

{
"jsonrpc": "2.0",
"id": 5,
"method": "destroy",
"params": {
"deploy_config": "{\"region\":\"us-west-2\"}",
"environment": "production",
"prior_state": "eyJydW50aW1lX2lkIjoiYWJjMTIzIn0="
}
}

Response:

{
"jsonrpc": "2.0",
"id": 5,
"result": {
"events": [
{
"type": "progress",
"message": "Deleting resources..."
},
{
"type": "complete",
"message": "All resources destroyed"
}
]
}
}
ParamTypeDescription
deploy_configstringJSON-encoded provider config
environmentstringTarget environment
prior_statestringOpaque adapter state

Queries current deployment status from the cloud provider.

Request:

{
"jsonrpc": "2.0",
"id": 6,
"method": "status",
"params": {
"deploy_config": "{\"region\":\"us-west-2\"}",
"environment": "production",
"prior_state": "eyJydW50aW1lX2lkIjoiYWJjMTIzIn0="
}
}

Response:

{
"jsonrpc": "2.0",
"id": 6,
"result": {
"status": "deployed",
"resources": [
{
"type": "agent_runtime",
"name": "greeting",
"status": "healthy",
"detail": "Running on instance i-abc123"
},
{
"type": "a2a_endpoint",
"name": "greeting",
"status": "healthy",
"detail": "Serving at https://example.com/a2a"
}
],
"state": "eyJydW50aW1lX2lkIjoiYWJjMTIzIn0="
}
}
ParamTypeDescription
deploy_configstringJSON-encoded provider config
environmentstringTarget environment
prior_statestringOpaque adapter state
Result FieldTypeDescription
statusstring"deployed", "not_deployed", "degraded", or "unknown"
resourcesResourceStatus[]Per-resource health
statestringUpdated adapter state (optional)

ResourceStatus:

FieldTypeDescription
typestringResource type
namestringResource name
statusstring"healthy", "unhealthy", or "missing"
detailstringAdditional info

Imports a pre-existing resource into deployment state. This lets the CLI manage resources that were created outside of the deploy workflow.

Request:

{
"jsonrpc": "2.0",
"id": 7,
"method": "import",
"params": {
"resource_type": "agent_runtime",
"resource_name": "my-agent",
"identifier": "container-abc123",
"deploy_config": "{\"region\":\"us-west-2\"}",
"environment": "production",
"prior_state": "eyJydW50aW1lX2lkIjoiYWJjMTIzIn0="
}
}

Response:

{
"jsonrpc": "2.0",
"id": 7,
"result": {
"resource": {
"type": "agent_runtime",
"name": "my-agent",
"status": "healthy",
"detail": "Imported from container-abc123"
},
"state": "eyJ1cGRhdGVkX3N0YXRlIjoiLi4uIn0="
}
}
ParamTypeDescription
resource_typestringResource type (e.g., "agent_runtime")
resource_namestringName to assign in local state
identifierstringProvider-specific resource identifier
deploy_configstringJSON-encoded provider config
environmentstringTarget environment name
prior_statestringOpaque adapter state (optional)
Result FieldTypeDescription
resourceResourceStatusImported resource details
statestringUpdated opaque adapter state

Standard JSON-RPC 2.0 error codes:

CodeNameDescription
-32700Parse ErrorInvalid JSON received
-32600Invalid RequestRequest object is not valid JSON-RPC
-32601Method Not FoundUnknown method name
-32603Internal ErrorProvider method returned an error

Adapters may also return custom error codes with descriptive messages:

{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32603,
"message": "AWS API error: AccessDeniedException: User is not authorized"
}
}

The CLI uses sequential integer IDs starting from 1. The adapter must include the matching id in each response. IDs are not reused within a single session.