Docs/Agents & tools

Agents & tools

Place model reasoning inside typed, testable workflows.

Configure a provider

Providers are ordinary actor dependencies. The included examples use a local OpenAI-compatible Ollama endpoint, but the workflow is not tied to one model host.

taskwish.ts
import { Actor, Provider } from "taskwish";

export const { Ollama } = Provider("Ollama", {
  baseURL: process.env.OLLAMA_BASE_URL
    ?? "http://127.0.0.1:11434/v1",
  models: ["qwen3:4b"],
});

export const { actor } = Actor("Researcher")
  .use(Ollama);

Agent steps

Agents can reason and call declared tools while deterministic steps prepare inputs, validate results, and produce side effects. Their streamed lifecycle is visible in Console.

src/researcher/research.ts
import { Agent, Step } from "taskwish";
import { actor } from "./researcher";

export const { research } = actor()
  .on("Command", "research")

  .input({ question: "string" })

  .run(
    Agent({
      model: "ollama/qwen3:4b",
      instructions: "Answer with concise, cited findings.",
    }),

    Step("answerQuestion", function () {
      return this.agent.generate({ prompt: this.input.question });
    }),
  )

  .meta({
    description: "Research a question with a local model",
  });

Start from a working architecture

The agent-loops template includes 18 patterns such as ReAct, reflection, evaluator-optimizer, supervisor-worker, and human approval. The agent-graphs template includes six topologies for routing, parallel work, map-reduce, hierarchy, and fallback.

Terminal
bunx @taskwish/create-project my-agents --template agent-loops
Note
Unit tests inject mock agents, so your test suite does not need a model server or API credentials.