🦞
Data Sources

openclaw_agents

Lists all configured OpenClaw agents.

Lists all configured agents with their settings. Returns both a flat list of agent IDs and a structured list with per-agent details.

Example Usage

data "openclaw_agents" "all" {}

output "agent_count" {
  value = length(data.openclaw_agents.all.agent_ids)
}

output "default_agent" {
  value = data.openclaw_agents.all.default_agent_id
}

output "agent_ids" {
  value = data.openclaw_agents.all.agent_ids
}

Create bindings for each agent

data "openclaw_agents" "all" {}

resource "openclaw_binding" "telegram" {
  for_each      = toset(data.openclaw_agents.all.agent_ids)
  agent_id      = each.value
  match_channel = "telegram"
}

Check if a specific agent exists

data "openclaw_agents" "all" {}

locals {
  has_research_agent = contains(data.openclaw_agents.all.agent_ids, "research")
}

Attribute Reference

AttributeTypeDescription
idStringAlways "agents".
default_agent_idStringThe agent ID marked as default.
agent_idsList(String)List of all agent IDs.
agentsList(Object)List of agents with their configuration.

Nested agents Object

AttributeTypeDescription
agent_idStringAgent identifier.
nameStringAgent display name.
is_defaultBoolWhether this is the default agent.
modelStringModel assigned to this agent.
workspaceStringWorkspace path for this agent.
sandbox_modeStringSandbox mode for this agent.
tools_profileStringTools profile for this agent.

On this page