sema-docs 1.23.0

Canonical structured documentation for Sema builtins/special forms; powers LSP hover/completion and REPL apropos
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
---
name: "agent/run"
module: "agent"
params: [{ name: agent, type: agent }, { name: message, type: string }, { name: opts, type: map }]
returns: "string"
---

Run an agent on a user message, executing its tools in a loop up to the agent's `:max-turns`. With two arguments it returns the final reply string. With an opts map it returns `{:response ... :messages ...}`; opts accepts `:messages` (prior history) and `:on-tool-call` (a callback invoked for each tool call). Each turn is generated with a fixed `max-tokens` of 4096.

```sema
(agent/run my-agent "Look up the weather in Oslo and summarize it.")
```