Skip to content
Konstera
Docs · Coding agents
Konstera documentation.

Getting started, SDK quickstart, manifest reference, kernel MCP services, deploy guide and FAQ — everything you need to build and run agents on Konstera.

Build with Claude Code

Konstera is designed so an LLM coding agent can build a working agent for you end-to-end — from scaffold through local test through deploy — without you reading the SDK source. This page is the single-source-of-truth preamble to give the coding agent before you start.

Same guide works for Claude Code, Cursor, Windsurf, ChatGPT, or any other LLM that can edit files + run commands. Just paste the Preamble section into your agent before asking it to build.

What you'll have at the end
A working Konstera agent — main.py, manifest.json and Dockerfile — written by your coding agent, smoke-tested locally, ready to build + deploy.
You need
A coding agent that can edit files + run commandsThe Preamble belowA one-sentence requirement
FlowHow you work with the coding agent Interactive — click a block

Install the Konstera plugin (Claude Code only)#

If you're on Claude Code, there's a native plugin that gives it first-class access to your tenant — your connectors, LLM engines, glossary, and more — via MCP, so Claude Code can author agents against what your tenant actually has, not training-data defaults.

Only want the tools, not the plugin's skills and commands? Connect Claude Code (or Cursor) straight to https://api.konstera.ai/mcp/devx and sign in in the browser: see Add Konstera to Claude Code or Cursor. Use one way, not both.

One command installs + activates it:

Terminal
# macOS / Linux
curl -fsSL https://konstera.ai/install/plugin-claude-code.sh | sh
PowerShell
# Windows (PowerShell)
irm https://konstera.ai/install/plugin-claude-code.ps1 | iex

Before you run it, install Claude Code itself — the Konstera installer adds the plugin to an existing Claude Code, it doesn't install Claude Code:

PowerShell
# Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex
Terminal
# macOS / Linux
curl -fsSL https://claude.ai/install.sh | bash

Then open a new terminal. Full guide: Claude Code setup.

What the script does:

  1. Checks everything it needs and reports it in one list — marked [ OK ], [ WARN ] or [MISSING], with the fix for each. If anything required is missing it stops before installing anything.
  2. Installs the konstera CLI, or updates it if it's older than 0.3.2.
  3. Downloads and verifies the plugin.
  4. Adds it to Claude Code with Claude Code's own claude plugin install, so every new Claude Code session loads it — no flags, no config files.

To see the dependency report without installing anything:

PowerShell
# Windows (PowerShell)
$env:KONSTERA_CHECK_ONLY = "1"; irm https://konstera.ai/install/plugin-claude-code.ps1 | iex
Terminal
# macOS / Linux
curl -fsSL https://konstera.ai/install/plugin-claude-code.sh | KONSTERA_CHECK_ONLY=1 sh
CheckedWindowsmacOS / LinuxRequired
Operating system64-bit Windows 10 (1809) or latermacOS or Linux, x86_64 or arm64Yes
Shell and toolsPowerShell 5.1+, TLS 1.2curl, tar, gzip, sha256sum or shasumYes
Network (HTTPS)konstera.ai, api.konstera.ai, platform-api.konstera.ai, api.github.com, github.com, release-assets.githubusercontent.comsameYes
Claude Codeclaude installed and new enough to support plugins (claude update if not)sameYes
Konstera CLIinstalled or updated by the scriptsameNo
Gitoptional; Claude Code's Bash tool uses Git Bash on WindowsoptionalNo

You don't need an Administrator window: everything installs for your own user. If Claude Code is installed but claude isn't on your PATH yet, the script still finds it and prints the PATH fix.

When it finishes, open (or restart) Claude Code, then inside Claude Code run:

Code
/konstera-signin

A tenant admin approves the pairing in a browser, and Claude Code lights up with Konstera MCP tools. From that point on, the Preamble below plus a sentence like "build me a refund-eligibility agent" produces working code against your real tenant shape.

Not on Claude Code? The Preamble pattern works identically for Cursor, Windsurf, ChatGPT or any other LLM that edits files + runs commands — just paste it as the first message. Native plugins for those tools are planned (ADR-057).

Preamble (paste this to your coding agent)#

You are building a Konstera agent.

What a Konstera agent is: an OCI container that speaks the Model Context Protocol (MCP). It subclasses konstera_sdk.Agent (Python) or inherits from Konstera.Sdk.Agent (.NET), overrides handle(), calls run(). The agent reaches back to the kernel for LLM calls, state, credentials, logging via ctx.log, ctx.llm, ctx.state, etc.

Entry point — konstera_sdk.Agent + run():

Python
from konstera_sdk import Agent, AgentContext, AgentRequest, AgentResponse, run

class MyAgent(Agent):
    async def handle(self, req: AgentRequest, ctx: AgentContext) -> AgentResponse:
        await ctx.log.info("hello", input=req.input)
        return AgentResponse(content=f"got: {req.input}")

run(MyAgent())

Services available on ctx: log, llm, state, vector, credentials, cost, tool, agents, artifact, human, rule, connector, capability, semantic. All are async methods. See /docs/kernel for the full surface.

Required files:

  • main.py — the agent code
  • manifest.json — see /docs/manifest-schema for the full schema
  • Dockerfile — multi-stage, pip install konstera-sdk

Rules:

  • Prefer purpose="narrator" over model="claude-sonnet-4-6" for LLM calls so the tenant admin can rebind without touching your code.
  • For optional capabilities, call await ctx.capability.available(name) before ctx.capability.call(name, ...) — otherwise CapabilityUnbound raises.
  • Never log a secret value (ctx.credentials.get() returns one — don't echo).
  • Agents MUST not import vendor SDKs (shopify, stripe, …). Go via ctx.capability.call(...) instead — the full set of canonical names lives in the capability catalogue. See /docs/kernel#capability and /docs/errors for why.

Env vars the kernel injects (don't set these yourself — see /docs/env-vars): KONSTERA_KERNEL_MCP_URL, KONSTERA_AGENT_INSTANCE_ID, KONSTERA_TENANT_ID, KONSTERA_AGENT_ID, KONSTERA_AGENT_VERSION.

Common pitfalls: see /docs/errors for every error the SDK/CLI/API can emit + how to recover.

To validate your work:

Terminal
# Local run in direct-run mode (no kernel):
pip install -e .
python -m main
# Then POST a test invocation:
curl -X POST http://localhost:8080/invoke \
  -H content-type:application/json \
  -d '{"invocationId":"test-1","input":"hello","config":{}}'

Reference agents to copy patterns from: github.com/Konstera/agents — hello-world-python for the minimum shape, customer-service-agent for a real reference with kernel services + eval harness + ADR-037 context service.

Three authoring patterns#

PatternToolsStatusWhat you get
A — IDE-integratedCursor, Windsurf, Claude CodeWorks todayThe coding agent edits files and runs commands in your repo
B — Chat with MCPClaude Desktop + Konstera MCPWorks todayYour tenant's connectors, models, agents and runs, and manifest validation, as chat tools
C — Pure chatChatGPT, Claude.ai web, GeminiWorks todayThree files to save to disk; you build + deploy manually

Pattern A — IDE-integrated (Cursor, Windsurf, Claude Code)#

  1. Clone a reference agent as a starter
    Terminal
    git clone https://github.com/Konstera/agents
    cp -r agents/hello-world-python my-agent && cd my-agent
    
  2. Open in your IDE
    Paste the Preamble into the agent chat.
  3. Describe what you want to build

    "Build a Konstera agent that triages inbound support tickets by severity and drafts a reply. Use ctx.capability.call('tickets.list_new') to fetch tickets, ctx.llm.complete(purpose='classifier') for severity, and ctx.human.request(tier='T1') for approval before replying via ctx.capability.call('tickets.reply')."

  4. Review the generated code
    Run through the review checklist below.
  5. Smoke-test, then ship
    Run locally in direct-run mode to smoke-test, then build + deploy.
Review the generated code — common pattern checks
  • handle() is async
  • All kernel calls are await-ed
  • AgentResponse is returned, not raised
  • Optional capabilities are guarded by available()

Pattern B — Chat with MCP (Claude Desktop + Konstera DevX MCP)#

  1. Add Konstera as a connector
    In Claude Desktop, open Customize › Connectors › + Add › Add custom connector with the URL https://api.konstera.ai/mcp/devx, click Connect and sign in with your Konstera account. Claude then acts as you, with your role. Details and the alternative (the Konstera extension): Add Konstera to Claude Desktop.
  2. Ask about your tenant
    Claude can now list your connectors, models and agents, look at runs, and validate a manifest while you design the agent.

Prefer Konstera running on your computer? Install the Konstera extension instead, or, if you already use the CLI, run konstera plugin activate claude-desktop (quit Claude Desktop first). Use one way only, or Claude sees the Konstera tools twice.

Pattern C — Pure chat (ChatGPT, Claude.ai web, Gemini)#

  1. Prime the chat
    Paste the Preamble + your requirements into the chat.
  2. Ask for the three files
    main.py, manifest.json, Dockerfile.
  3. Save and ship
    Save to disk. Build + deploy manually.
  4. Check every method name
    If the chat LLM hallucinates a method name (e.g. ctx.database.query), check against /docs/kernel — only the 15 services listed there exist.

Four workflows that come up often#

WorkflowYou give the coding agentYou should get backStatus
Scaffold from a one-sentence requirementThe requirementA working agentWorks today
Edit-test-fix loopThe failing errorA graceful fallbackWorks today
Capture fixtures from a live run——Planned
Debug a failing invocationTrace + handle() codeRoot cause + fixWorks today

"Scaffold from a one-sentence requirement"#

Text
Build a Konstera agent that polls a Zendesk inbox every hour, classifies new
tickets by product area, and routes them to the right team's Slack channel.
Use ctx.capability.call('tickets.list_new') for polling and
ctx.capability.call('chat.reply') for Slack. Classification uses
ctx.llm.complete(purpose='classifier').

Expected output: a working agent with manifest schedule + capability declarations + handle() logic + a reasonable prompt.

"Edit-test-fix loop"#

Text
The invocation is failing with CapabilityUnbound: Agent has no binding for
'tickets.reply'. Fix the agent so it falls back gracefully.

Expected fix: wrap the tickets.reply call with await ctx.capability.available(name) and route to ctx.log.warn() + ctx.human.request(tier='T1', ...) fallback.

ArchitectureThe graceful fallback the coding agent should produce Interactive — click a block

"Capture fixtures from a live run"#

Planned Planned via konstera dev --record (per roadmap). Not shipping yet.

"Debug a failing invocation"#

SequenceDebugging with a coding agent
YouPortalCoding agent1open the invocation trace2exception + stack trace3trace + relevant handle() codediagnose the root cause4fix

Open the portal invocation trace. Paste the exception + stack trace + the relevant handle() code into your coding agent with:

Text
This Konstera agent invocation failed with the attached trace. The agent's
handle() code is attached. Diagnose the root cause and fix.

The coding agent should be able to identify things like missing await, unguarded optional capability calls, or incorrect manifest needs[] declarations.

Pattern gotchas (what coding agents commonly get wrong)#

Gotcha❌ Coding agent writes✅ Should write
1. Import vendor SDKsimport shopifyctx.capability.call(...)
2. Forget awaitctx.log.info("x")await ctx.log.info("x")
3. Return instead of raisean exception for a business errorreturn AgentResponse(...)
4. Store secrets in configreq.config["stripe_key"]ctx.credentials.get(...)
5. Over-declare needs[]services the code never callsonly what the code uses
6. Hard-code the modelmodel="claude-sonnet-4-6"purpose="narrator"

Why each one matters:

  1. Import vendor SDKs. ❌ import shopify / ✅ await ctx.capability.call("orders.lookup_by_id", ...). Vendor-specific logic goes in the connector, not the agent — this is the whole point of the capability layer. See /docs/kernel.

  2. Forget await. The SDK is fully async. Every ctx.* call returns a coroutine. ctx.log.info("x") without await is a no-op — the message is never sent.

  3. Return instead of raise. Business errors go in the response: return AgentResponse(content="", structured={"error": "..."}). Exceptions mean "the invocation itself failed" and produce HTTP 500 — reserve them for actual bugs.

  4. Store secrets in config. ❌ req.config["stripe_key"] / ✅ await ctx.credentials.get("stripe-api-key"). Config is per-instance tenant-set tenant-visible; credentials are tenant-scoped encrypted.

  5. Over-declare needs[]. The manifest's needs[] is a permission list — the kernel refuses runtime calls to anything not declared. But over-declaring broadens the capability footprint shown in the portal (and under some policies, blocks install). Only list what you actually use.

  6. Hard-code model="claude-sonnet-4-6". Prefer purpose="narrator" — the tenant admin can rebind the purpose to a different model + credentials via portal without redeploying your agent.

What next#