SDK quickstart
Konstera agents are OCI containers that speak the Model Context Protocol (MCP). The SDK is a thin wrapper around an MCP server: your agent receives invocations from the kernel, calls kernel services (LLM, state, credentials, tools), and returns a result or requests a reviewer approval.
Two first-class SDK languages today: Python and .NET. A TypeScript SDK follows. Any language that can speak MCP over stdio or HTTP works — these two just have idiomatic wrappers.
Hello world#
- Install the SDK
Python — install the
konstera-sdkwheel (private PyPI during beta; public PyPI on v1.0). .NET — add theKonstera.SdkNuGet package (private feed during beta; public NuGet on v1.0).Terminalpython -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install konstera-sdkTerminaldotnet new console -n HelloAgent cd HelloAgent dotnet add package Konstera.Sdk --prerelease - Write the handler
main.py(Python) orProgram.cs(.NET):Pythonfrom konstera_sdk import Agent agent = Agent("hello-world") @agent.on_invoke async def handle(ctx): name = ctx.input["name"] # Kernel LLM service — same shape as .NET, no provider SDK required. reply = await ctx.llm.complete( system="You are a cheerful retail assistant.", user=f"Greet the customer: {name}", ) return {"greeting": reply.text} if __name__ == "__main__": agent.run()C#using Konstera.Sdk; var agent = new Agent("hello-world"); agent.OnInvoke(async (ctx) => { var input = ctx.Input<HelloInput>(); // Call the kernel LLM service — no provider SDK here; // the kernel resolves to the tenant's configured model + key. var reply = await ctx.Llm.CompleteAsync( system: "You are a cheerful retail assistant.", user: $"Greet the customer: {input.Name}"); return new HelloResult { Greeting = reply.Text }; }); await agent.RunAsync(); record HelloInput(string Name); record HelloResult { public string Greeting { get; init; } = ""; }
The same shape in both languages:
| Piece | Python | .NET | What it does |
|---|---|---|---|
| Entry point | Agent("hello-world") | new Agent("hello-world") | Creates the agent |
| Handler | @agent.on_invoke | agent.OnInvoke(...) | Registers the function the kernel invokes |
| Context | ctx | ctx (an AgentContext) | Exposes every kernel service — strongly-typed facades in .NET |
| LLM call | ctx.llm.complete(...) | ctx.Llm.CompleteAsync(...) | Kernel resolves to the tenant's configured model + key |
| Run | agent.run() | await agent.RunAsync() | Starts the agent |
See Kernel MCP services for the full list of services on ctx.
Dockerfile#
Agents ship as containers. Multi-stage builds are the common pattern — build in one image, publish a small runtime image. The kernel spawns one container instance per invocation.
# Python
FROM python:3.12-slim AS runtime
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "main.py"]
# .NET
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "HelloAgent.dll"]
Manifest#
Every agent ships with a manifest.json that declares
what it is, what it needs, and how it behaves.
{
"$schema": "https://schemas.konstera.ai/agent-manifest.v3.json",
"id": "hello-world",
"version": "0.1.0",
"name": "Hello World",
"description": "Greets the customer by name.",
"runtime": {
"kind": "container",
"image": "ghcr.io/your-org/hello-world:0.1.0"
},
"input": {
"type": "object",
"properties": {
"name": { "type": "string" }
},
"required": ["name"]
},
"autonomy": "autonomous",
"needs": ["llm"]
}
Full field reference in Manifest reference.
Human-in-the-loop#
Agents that draft customer-visible content (emails, support replies, PO approvals) typically return their output as a reviewer request instead of sending it directly:
// .NET
var decision = await ctx.Human.RequestAsync(new ReviewerRequest {
Draft = reply.Text,
Rationale = "Loyalty tier: gold, 2nd return this month",
Thread = ctx.Thread,
});
if (decision.Approved) {
await ctx.Tool.SendEmailAsync(decision.FinalText);
}
The reviewer sees the draft in their inbox with four actions —
send, edit, redraft, reject. See
the platform overview for the inbox UX and
kernel services for the full ctx.human API.