{"slug": "show-hn-kastor-terraform-style-specs-for-ai-agents", "title": "Show HN: Kastor – Terraform-style specs for AI agents", "summary": "Kastor, a new open-source tool, provides Terraform-style declarative specs for AI agents, allowing developers to define agents in versionable HCL files and compile them to target frameworks like LangGraph or reconcile them as long-lived resources on hosted platforms. The tool aims to replace imperative agent definitions and platform-specific UIs with a vendor-neutral, reviewable source of truth.", "body_md": "Kastor is \"Terraform for AI agents.\" Agents today are defined imperatively inside frameworks (LangGraph, CrewAI) or clicked together in platform UIs (OpenAI Assistants, Bedrock Agents) — there is no vendor-neutral, versionable, reviewable source of truth. Kastor provides one: a typed, declarative spec (`.agent`\n\n, `.tool`\n\n, `.prompt`\n\nfiles in HCL) and a Go toolchain with two paths — `kastor build`\n\ngenerates runnable projects for target frameworks, and `kastor plan`\n\n/ `kastor apply`\n\nreconcile agents as long-lived resources on hosted platforms, with state, diffs, and drift detection.\n\nThe full design lives in [SPEC.md](/weirdGuy/kastor/blob/main/SPEC.md).\n\nHomebrew:\n\n```\nbrew tap weirdGuy/tap && brew install kastor\n```\n\nInstall script (verifies the release checksum, installs to `/usr/local/bin`\n\nor `~/.local/bin`\n\n, never sudo):\n\n```\ncurl -fsSL https://raw.githubusercontent.com/weirdGuy/kastor/main/scripts/install.sh | sh\n```\n\nWith Go 1.26+:\n\n```\ngo install github.com/weirdGuy/kastor/cmd/kastor@latest\n```\n\nOr download an archive for your platform from the [releases page](https://github.com/weirdGuy/kastor/releases), verify it against `checksums.txt`\n\n, and put the `kastor`\n\nbinary on your PATH.\n\nPrerequisites: Go 1.26+, Python 3.11+, an OpenAI API key, and a [Tavily](https://tavily.com) API key (the example's search tool runs against Tavily's hosted MCP server).\n\nCompile the spec to a LangGraph project:\n\n```\ngo build ./cmd/kastor\n./kastor validate examples/weather/\n./kastor build examples/weather/\n```\n\n`kastor build`\n\nwrites the generated project to `examples/weather/gen/langgraph`\n\n(the target's declared `output`\n\n). Generated output is not committed: it is reproducible from the spec, and codegen determinism is enforced by tests.\n\nSet up the generated project:\n\n```\ncd examples/weather/gen/langgraph\npython3 -m venv .venv\n. .venv/bin/activate\npip install -r requirements.txt\n```\n\nThe example's `web_search`\n\ntool is pinned to an MCP server and tool by its spec URI, `mcp://search-server/tavily_search`\n\n. How to *reach* that server is deployment configuration, not spec: create `mcp_servers.json`\n\nin the working directory (or point the `KASTOR_MCP_CONFIG`\n\nenv var at a file elsewhere). For Tavily's hosted server:\n\n```\n{\n  \"search-server\": {\n    \"transport\": \"streamable_http\",\n    \"url\": \"https://mcp.tavily.com/mcp/?tavilyApiKey=tvly-YOUR-KEY\"\n  }\n}\n```\n\nThe URL embeds your API key, which is why `mcp_servers.json`\n\nis gitignored — treat it as a secret, never commit it. Also note the spec URI's last path segment (`tavily_search`\n\n) must name a tool the server actually advertises, or calls fail with \"does not expose tool\".\n\nExport the model credential (the example's `model \"fast\"`\n\nblock uses provider `openai`\n\n):\n\n```\nexport OPENAI_API_KEY=sk-...\n```\n\nRun the agent:\n\n```\npython3 main.py weather --inputs '{\"location\": \"Lisbon\", \"date\": \"tomorrow\"}'\n```\n\nIt prints the agent's declared output contract as JSON:\n\n```\n{\n  \"weather\": \"...\"\n}\n```\n\nThe generated `README.md`\n\ninside `gen/langgraph`\n\nowns the run-the-project side in full: every agent's inputs and outputs, tool bindings, and MCP configuration.\n\nOne v0 caveat (SPEC.md §3.2/§4): `agent.weather`\n\n's optional `forecast_context`\n\ninput references `agent.forecast`\n\n's output. That reference is validated at compile time and orders the dependency graph, but generated code does not run the upstream agent for you — if you want the context, run `forecast`\n\nyourself and pass its summary via `--inputs`\n\n.\n\n```\ngo build ./...   # build everything\ngo test ./...    # run all tests\n```\n\nSPEC.md is the source of truth for design decisions; CLAUDE.md documents the day-to-day conventions.", "url": "https://wpnews.pro/news/show-hn-kastor-terraform-style-specs-for-ai-agents", "canonical_source": "https://github.com/weirdGuy/kastor", "published_at": "2026-07-08 15:25:09+00:00", "updated_at": "2026-07-08 15:53:28.703352+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-infrastructure"], "entities": ["Kastor", "LangGraph", "CrewAI", "OpenAI", "Bedrock Agents", "Tavily"], "alternates": {"html": "https://wpnews.pro/news/show-hn-kastor-terraform-style-specs-for-ai-agents", "markdown": "https://wpnews.pro/news/show-hn-kastor-terraform-style-specs-for-ai-agents.md", "text": "https://wpnews.pro/news/show-hn-kastor-terraform-style-specs-for-ai-agents.txt", "jsonld": "https://wpnews.pro/news/show-hn-kastor-terraform-style-specs-for-ai-agents.jsonld"}}