Skip to content

Environment Variables

The AgentCore adapter injects environment variables into agent runtimes via the EnvironmentVariables field on CreateAgentRuntime and UpdateAgentRuntime API calls. These variables allow runtime code to discover configuration, peer agents, and deployed resources.

VariableSourceWhen SetDescription
PROMPTPACK_PROVIDER_TYPEArena config deploy.agentcoreAlways (code deploy)LLM provider type (e.g. "bedrock"). Used by the runtime to select the correct provider.
PROMPTPACK_PROVIDER_MODELArena config deploy.agentcore.modelAlways (code deploy)Bedrock model ID (e.g. "claude-3-5-haiku-20241022"). Used by the runtime to configure the LLM.
PROMPTPACK_PACK_JSONPack file contentsAlways (code deploy)The full pack JSON, injected so the runtime can load the pack without a separate file.
PROMPTPACK_LOG_GROUPobservability.cloudwatch_log_groupWhen cloudwatch_log_group is a non-empty stringCloudWatch log group name for structured logging.
PROMPTPACK_TRACING_ENABLEDobservability.tracing_enabledWhen tracing_enabled is trueEnables AWS X-Ray tracing. Value is the string "true".
PROMPTPACK_MEMORY_STOREmemory_store config fieldWhen memory_store is setMemory store type: "session" or "persistent".
PROMPTPACK_MEMORY_IDMemory resource ARNAfter memory resource creation during ApplyThe ARN of the created memory resource. Allows runtimes to connect to the memory store.
PROMPTPACK_AGENTSRuntime resource ARNsMulti-agent packs only, after all runtimes are createdJSON object mapping agent member names to their runtime ARNs. Injected on the entry agent only.
PROMPTPACK_A2A_AUTH_MODEa2a_auth.modeWhen a2a_auth is configured with a non-empty modeA2A authentication mode: "iam" or "jwt".
PROMPTPACK_A2A_AUTH_ROLEruntime_role_arnWhen a2a_auth.mode is "iam"The IAM role ARN used for A2A authentication between agents.
PROMPTPACK_POLICY_ENGINE_ARNCedar policy resource ARNsAfter Cedar policy creation during ApplyComma-separated list of policy engine ARNs. Set when prompts define validators or tool_policy.
PROMPTPACK_METRICS_CONFIGPack evals with metricsWhen at least one eval defines a metricJSON MetricsConfig object describing CloudWatch metrics for eval reporting.
PROMPTPACK_DASHBOARD_CONFIGPack structure (agents + evals)When the pack has agents or eval metricsJSON DashboardConfig object describing a CloudWatch dashboard layout.
PROMPTPACK_PROTOCOLprotocol config fieldWhen protocol is set to a non-empty valueServer protocol mode: "http", "a2a", or "both". Controls which servers the runtime starts. See Runtime Protocols.
PROMPTPACK_AGENTPack prompt/agent nameMulti-agent packs; set per-runtimeThe agent name this runtime serves. Omitted for single-agent packs to allow auto-discovery.

Set from the arena config’s deploy.agentcore section. Tells the runtime which LLM provider to use. For AgentCore deployments, this is always "bedrock".

PROMPTPACK_PROVIDER_TYPE=bedrock

Set from the arena config’s deploy.agentcore.model field. Specifies the Bedrock model ID the runtime should use for LLM invocations.

PROMPTPACK_PROVIDER_MODEL=claude-3-5-haiku-20241022

Injected during code deploy. Contains the entire compiled pack JSON so the runtime can load the pack directly from the environment without needing a separate file on disk.

PROMPTPACK_PACK_JSON={"id":"my-agent","version":"v1.0.0","prompts":{...}}

Set from observability.cloudwatch_log_group. Runtimes use this to direct structured logs to the specified CloudWatch log group.

PROMPTPACK_LOG_GROUP=/aws/agentcore/my-pack

Set from observability.tracing_enabled. Only injected when the value is true. Runtimes use this to enable X-Ray trace instrumentation.

PROMPTPACK_TRACING_ENABLED=true

Set from the top-level memory_store config field. Tells the runtime which memory strategy to use.

PROMPTPACK_MEMORY_STORE=session

Injected at Apply time after the memory resource is successfully created. Contains the full ARN of the memory resource.

PROMPTPACK_MEMORY_ID=arn:aws:bedrock:us-west-2:123456789012:memory/abc123

Injected on the entry agent only in multi-agent packs, after all agent runtimes are created. Contains a JSON object mapping each agent member name to its runtime ARN.

{
"planner": "arn:aws:bedrock:us-west-2:123456789012:agent-runtime/rt-001",
"researcher": "arn:aws:bedrock:us-west-2:123456789012:agent-runtime/rt-002",
"writer": "arn:aws:bedrock:us-west-2:123456789012:agent-runtime/rt-003"
}

Only runtimes with status "created" or "updated" are included in the map. If a member runtime failed to create, it is omitted.

Set when a2a_auth is configured. Indicates the authentication mechanism used for agent-to-agent communication.

PROMPTPACK_A2A_AUTH_MODE=iam

Set when a2a_auth.mode is "iam" and runtime_role_arn is non-empty. Provides the IAM role ARN that agents use to authenticate with each other.

PROMPTPACK_A2A_AUTH_ROLE=arn:aws:iam::123456789012:role/AgentCoreRuntime

Injected after all Cedar policy resources are created. Contains a comma-separated list of policy engine ARNs, one per prompt that has validators or tool_policy.

PROMPTPACK_POLICY_ENGINE_ARN=arn:aws:bedrock:us-west-2:123456789012:policy-engine/pe-001,arn:aws:bedrock:us-west-2:123456789012:policy-engine/pe-002

Injected when at least one eval in the pack defines a metric. Contains a JSON MetricsConfig object that describes the CloudWatch metrics the runtime should emit.

Example payload:

{
"namespace": "PromptPack/Evals",
"dimensions": {
"pack_id": "my-pack",
"agent": "multi"
},
"metrics": [
{
"eval_id": "accuracy_eval",
"metric_name": "accuracy_score",
"metric_type": "gauge",
"unit": "None"
},
{
"eval_id": "latency_eval",
"metric_name": "response_latency",
"metric_type": "histogram",
"unit": "Milliseconds"
},
{
"eval_id": "error_eval",
"metric_name": "error_count",
"metric_type": "counter",
"unit": "Count"
}
],
"alarms": [
{
"metric_name": "accuracy_score",
"min": 0.8
},
{
"metric_name": "response_latency",
"max": 5000.0
}
]
}

MetricsConfig fields:

FieldTypeDescription
namespacestringCloudWatch namespace. Always "PromptPack/Evals".
dimensionsmap[string]stringDimension key-value pairs. Always includes pack_id. Includes "agent": "multi" for multi-agent packs.
metricsMetricEntry[]One entry per eval metric.
alarmsAlarmEntry[]Optional. One entry per metric that defines a range.

MetricEntry fields:

FieldTypeDescription
eval_idstringThe eval identifier from the pack definition.
metric_namestringCloudWatch metric name.
metric_typestringMetric type from the eval definition (e.g. "gauge", "counter", "histogram", "boolean").
unitstringCloudWatch unit. Mapped from metric type: counter -> "Count", histogram -> "Milliseconds", gauge/boolean -> "None".

AlarmEntry fields:

FieldTypeDescription
metric_namestringThe metric this alarm applies to.
minfloat64 (optional)Minimum acceptable value.
maxfloat64 (optional)Maximum acceptable value.

Injected when the pack has agents or eval metrics. Contains a JSON DashboardConfig object that describes a CloudWatch dashboard layout with widgets for agent runtime metrics, A2A latency (multi-agent), and eval metrics.

Example payload (multi-agent pack with one eval metric):

{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 12,
"height": 6,
"properties": {
"title": "Agent: planner",
"region": "us-west-2",
"period": 300,
"metrics": [
["PromptPack/Evals", "Invocations", "agent", "planner"],
["PromptPack/Evals", "Errors", "agent", "planner"],
["PromptPack/Evals", "Duration", "agent", "planner"]
]
}
},
{
"type": "metric",
"x": 12,
"y": 0,
"width": 12,
"height": 6,
"properties": {
"title": "Agent: researcher",
"region": "us-west-2",
"period": 300,
"metrics": [
["PromptPack/Evals", "Invocations", "agent", "researcher"],
["PromptPack/Evals", "Errors", "agent", "researcher"],
["PromptPack/Evals", "Duration", "agent", "researcher"]
]
}
},
{
"type": "metric",
"x": 0,
"y": 6,
"width": 24,
"height": 6,
"properties": {
"title": "Inter-Agent A2A Call Latency",
"region": "us-west-2",
"period": 300,
"metrics": [
["PromptPack/Evals", "A2ALatency", "agent", "planner"],
["PromptPack/Evals", "A2ALatency", "agent", "researcher"]
]
}
},
{
"type": "metric",
"x": 0,
"y": 12,
"width": 12,
"height": 6,
"properties": {
"title": "Eval: accuracy_score",
"region": "us-west-2",
"period": 300,
"metrics": [
["PromptPack/Evals", "accuracy_score", "pack_id", "my-pack"]
],
"annotations": {
"horizontal": [
{ "label": "min", "value": 0.8, "color": "#2ca02c" },
{ "label": "max", "value": 1.0, "color": "#d62728" }
]
}
}
}
]
}

DashboardConfig fields:

FieldTypeDescription
widgetsDashboardWidget[]Ordered list of dashboard widgets.

DashboardWidget fields:

FieldTypeDescription
typestringAlways "metric".
xintHorizontal grid position (0 or 12 for two-column layout).
yintVertical grid position. Increments by 6 (widget height) per row.
widthintWidget width. 12 for standard widgets, 24 for full-width (A2A latency).
heightintWidget height. Always 6.
propertiesobjectWidget display properties including title, region, period, metrics, and optional annotations.

Widget types generated:

WidgetWhen GeneratedLayout
Agent runtime metrics (Invocations, Errors, Duration)One per agent member (or pack ID for single-agent)Two-column, 12 units wide
A2A call latencyMulti-agent packs onlyFull-width, 24 units wide
Eval metricOne per eval with a metric definitionTwo-column, 12 units wide, with optional min/max threshold annotations

Set from the protocol config field. Controls which servers the runtime starts: the HTTP bridge (port 8080), the A2A server (port 9000), or both.

PROMPTPACK_PROTOCOL=both

See Runtime Protocols for details on the HTTP bridge endpoints and payload formats.

Set per-runtime in multi-agent packs. Contains the agent/prompt name this runtime serves. Omitted for single-agent packs to allow the runtime to auto-discover the single prompt from the pack.

PROMPTPACK_AGENT=coordinator

Environment variables are built and injected at different points during the Apply lifecycle:

TimingVariables
Before any resource creationPROMPTPACK_PROVIDER_TYPE, PROMPTPACK_PROVIDER_MODEL, PROMPTPACK_PACK_JSON, PROMPTPACK_LOG_GROUP, PROMPTPACK_TRACING_ENABLED, PROMPTPACK_MEMORY_STORE, PROMPTPACK_A2A_AUTH_MODE, PROMPTPACK_A2A_AUTH_ROLE, PROMPTPACK_METRICS_CONFIG, PROMPTPACK_DASHBOARD_CONFIG, PROMPTPACK_PROTOCOL, PROMPTPACK_AGENT
After memory creation (pre-step)PROMPTPACK_MEMORY_ID
After Cedar policy creation (phase 2)PROMPTPACK_POLICY_ENGINE_ARN
After runtime creation (phase 3)PROMPTPACK_AGENTS (injected via UpdateRuntime on entry agent)

Variables injected before resource creation are available to all runtimes at creation time. Variables injected after a phase require a subsequent UpdateAgentRuntime call to propagate to already-created runtimes.