v0.1.0GitHubnpm
Getting started

Quickstart

An agent is three things: a provider that talks to the model, a tool set it can call, and a permission policy that decides what’s allowed. Wire them together, open a session, and consume the event stream.

agent.ts
import { Agent } from "@skawld/agent-sdk";
import { AnthropicProvider } from "@skawld/agent-sdk/providers";
import { defaultTools } from "@skawld/agent-sdk/tools";

const agent = new Agent({
  provider: new AnthropicProvider(),   // reads ANTHROPIC_API_KEY
  model: "claude-opus-4-5",
  tools: defaultTools(),
  permissions: { mode: "default" },
});

const session = await agent.session();

for await (const event of session.run("List the files in the current directory.")) {
  if (event.type === "assistant") {
    for (const block of event.message.content) {
      if (block.type === "text") process.stdout.write(block.text);
    }
  }
  if (event.type === "result") break;
}

await agent.close();

Each session.run() call returns an async iterator of typed events — the model’s text, every tool the agent tried to invoke, and a final result when the loop stops.

#Environment

Providers read their API keys from the environment by default. You can also pass apiKey explicitly when constructing a provider — useful for tests or multi-tenant servers.

env
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
SKAWLD_MODEL=gpt-5             # used by examples; ignored by Agent constructor
SKAWLD_CONFIG_DIR=.skawld      # session store + skills + agents

#Next

Once it’s talking, customise tools, tighten permissions, and pick a session store.