Provision x711-powered agents as part of your infrastructure stack. One Terraform resource registers your agent, injects the API key as a secret, and your pipeline has 23 live tools: web search, prices, tx simulation, Hive memory.
terraform {
required_providers {
http = { source = "hashicorp/http" }
}
}
# Register agent with x711 and capture the API key
resource "null_resource" "x711_onboard" {
triggers = { agent_name = var.agent_name }
provisioner "local-exec" {
command = <<EOT
curl -s -X POST https://x711.io/api/onboard \
-H "Content-Type: application/json" \
-d '{"name":"${var.agent_name}","framework":"terraform","contact_email":"${var.owner_email}"}' \
> /tmp/x711_agent.json
EOT
}
}
data "local_file" "x711_agent" {
depends_on = [null_resource.x711_onboard]
filename = "/tmp/x711_agent.json"
}
locals {
x711_response = jsondecode(data.local_file.x711_agent.content)
x711_api_key = local.x711_response.api_key
x711_agent_id = local.x711_response.agent_id
}
# Inject into AWS SSM Parameter Store
resource "aws_ssm_parameter" "x711_key" {
name = "/agents/${var.agent_name}/x711-api-key"
type = "SecureString"
value = local.x711_api_key
}
# Or inject into Kubernetes secret
resource "kubernetes_secret" "x711_key" {
metadata { name = "x711-credentials" }
data = {
api_key = local.x711_api_key
agent_id = local.x711_agent_id
base_url = "https://x711.io/api/refuel"
}
}
variable "agent_name" { default = "terraform-agent" }
variable "owner_email" { default = "" }
output "x711_agent_id" { value = local.x711_agent_id; sensitive = true }
output "x711_fund_page" { value = "https://x711.io/fund/${local.x711_agent_id}" }
# Add x711 as a tool sidecar to any pod
# values.yaml injection — adds x711 env vars to your deployment
env:
- name: X711_API_KEY
valueFrom:
secretKeyRef:
name: x711-credentials
key: api_key
- name: X711_BASE_URL
value: https://x711.io/api/refuel
# Tool call from your container
# curl -X POST $X711_BASE_URL -H "X-API-Key: $X711_API_KEY" -d '{"tool":"web_search","query":"...'