Skip to content
Learn
Learn

AgentField Documentation

The AI backend. Build, deploy, and govern AI agents like APIs.

The AI backend. Build, deploy, and govern AI agents like APIs.

Code to API — write a function, get a production endpoint
curl -sSf https://agentfield.ai/get | sh

/

Fastest way in: one prompt, full backend

After install, type /agentfield in Claude Code — or describe your system in plain English. Stack is live under docker compose in one shot.

Try it →

from agentfield import Agent, AIConfig
from pydantic import BaseModel

app = Agent("demo", ai_config=AIConfig(model="anthropic/claude-sonnet-4-20250514"))

class Decision(BaseModel):
    action: str

@app.reasoner()
async def route(text: str) -> dict:
    out = await app.ai(
        system="Pick one action: summarize | escalate | done.",
        user=text,
        schema=Decision,
    )
    return out.model_dump()

app.run()
import { Agent } from "@agentfield/sdk";
import { z } from "zod";

const agent = new Agent({
  nodeId: "demo",
  aiConfig: { provider: "anthropic", model: "claude-sonnet-4-20250514" },
});

agent.reasoner("route", async (ctx) => {
  return await ctx.ai(ctx.input.text, {
    system: "Pick one action: summarize | escalate | done.",
    schema: z.object({ action: z.string() }),
  });
});

agent.serve();
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/Agent-Field/agentfield/sdk/go/agent"
	"github.com/Agent-Field/agentfield/sdk/go/ai"
)

type Decision struct {
	Action string `json:"action"`
}

func main() {
	a, err := agent.New(agent.Config{
		NodeID:        "demo",
		Version:       "1.0.0",
		AgentFieldURL: "http://localhost:8080",
		AIConfig:      &ai.Config{Model: "anthropic/claude-sonnet-4-20250514"},
	})
	if err != nil {
		log.Fatal(err)
	}

	a.RegisterReasoner("route", func(ctx context.Context, input map[string]any) (any, error) {
		text := fmt.Sprintf("%v", input["text"])
		resp, err := a.AI(ctx, text,
			ai.WithSystem("Pick one action: summarize | escalate | done."),
			ai.WithSchema(Decision{}),
		)
		if err != nil {
			return nil, err
		}
		var d Decision
		resp.JSON(&d)
		return d, nil
	})

	a.Serve(context.Background())
}
  • APIs — decorated functions become HTTP endpoints with discovery and tracing.
  • Models — 100+ LLMs, structured output (Pydantic / Zod / structs), tool calling.
  • Multi-agentapp.call, shared memory, async, webhooks, governance (DIDs, policy, audit).