---
title: weft concepts
description: The ideas the rest of weft builds on — agents, runs, tools, the loop, messages, models, errors and stopping — in the order to learn them.
url: https://weftgo.dev/docs/concepts/
type: concept
sources:
  - weft/AGENTS.md:1-30
---

# weft concepts

These pages explain what weft's core pieces are and how they behave, one idea per page. Read them in order: each one uses only the ideas of the pages before it. The how-to guides apply them; the [reference](https://weftgo.dev/docs/reference/) holds the tables.

1. [What is an agent in weft?](https://weftgo.dev/docs/concepts/agents/) — an agent is an immutable value: a model, instructions, tools and policy, built once with `weft.New` and run concurrently.
2. [What does a run return?](https://weftgo.dev/docs/concepts/runs/) — `Generate` returns a `RunResult`: the run's id, the transcript, one record per step, the usage.
3. [How do tools work?](https://weftgo.dev/docs/concepts/tools/) — a tool is a Go function; its input struct's tags are the schema the model sees.
4. [What happens in one step?](https://weftgo.dev/docs/concepts/the-loop/) — one model call, then one batch of tool calls that start in call order, run in parallel and land in call order.
5. [Messages, parts and the transcript](https://weftgo.dev/docs/concepts/messages/) — a message is a role plus typed parts; transcripts round-trip through JSON and `weft.Repair` keeps them valid.
6. [What is a Model?](https://weftgo.dev/docs/concepts/models/) — the provider seam: one `Stream` method and a contract the loop enforces.
7. [Tool errors are data, run errors are yours](https://weftgo.dev/docs/concepts/errors/) — a failed tool call is a result the model reads; a failed run is a `*RunError` you handle.
8. [How does a run stop?](https://weftgo.dev/docs/concepts/budgets-and-stopping/) — the intended end succeeds; a budget or a cancellation fails the run with a named error.

Two ideas build on these and have their own sections: approval as a run boundary ([Require human approval for a tool](https://weftgo.dev/docs/guides/approvals/)) and durable conversations ([What is a session?](https://weftgo.dev/docs/sessions/overview/)). Why the core is shaped this way is in [Explanation](https://weftgo.dev/docs/explanation/).

## See also

- [Quickstart: run an agent in five minutes](https://weftgo.dev/docs/get-started/quickstart/)
- [The agent loop, from first principles](https://weftgo.dev/docs/explanation/agent-loop/)
- [Glossary](https://weftgo.dev/docs/reference/glossary/)
- [Package weft on pkg.go.dev](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2)
