Skip to main content

Getting started

Requirements

  • The Go version declared in go.mod.
  • An Anthropic API key and reachable endpoint.
  • A sandbox or local environment in which the configured tools may run.

Build

git clone https://github.com/yanpgwang/agentcore
cd agentcore
go build -o agentcore ./cmd/agentcore

Configure

Create config.json:

{
"system_prompt": "You are a helpful coding agent.",
"model": "claude-sonnet-4-6",
"initial_prompt": "List all TODO entries in the project.",
"permission": "always_allow"
}

Run the process:

export ANTHROPIC_API_KEY="..."
./agentcore \
--session-id local-1 \
--agent-config config.json

The command writes agent events to stdout as newline-delimited JSON and diagnostics to stderr. It is a one-shot runner: the process exits after the initial Turn reaches completed, failed, or cancelled.

Embed the package

The root package exposes Agent, Scheduler, Session, messages, tools and events. A caller creates a Session, sends client events and consumes agent events:

scheduler := agentcore.NewScheduler()
session := scheduler.Spawn(ctx, agentcore.AgentConfig{
ID: "session-1",
Model: "claude-sonnet-4-6",
SystemPrompt: "You are a coding agent.",
Tools: registry,
})
defer session.Kill()

session.Send(agentcore.ClientEvent{
Type: agentcore.ClientEventUserMessage,
Content: []agentcore.ContentBlock{
agentcore.TextBlock("Inspect this repository."),
},
})

for event := range session.Events {
// Forward or persist the typed event.
}

Read Lifecycle before deciding how long a Session should live in a worker.