ztcl::agent
ztcl::agent subcommand ?arg ...?
Runs an LLM agent loop in an isolated thread with no capability, which holds only the data and the tools that the host gives it. The host posts each request to its one endpoint with its own headers, runs only its own tools, and checks the result against a schema. Load it with package require ztcl::agent.
Subcommands
| Synopsis | What it does |
|---|---|
ztcl::agent run ?-option value ...? |
Runs the loop. Gives a dict of the result, the log, and the counts. |
ztcl::agent doc NAME TEXT ?ARG TYPE ...? |
Sets the text of the tool NAME and the types of its arguments. |
ztcl::agent describe NAME |
The spec of the command NAME as a tool: name, text, JSON schema, and parameters. |
ztcl::agent check SCHEMA VALUE |
VALUE when it matches the result schema SCHEMA, else the error ZTCL AGENT RESULT. |
ztcl::agent schema SCHEMA |
The JSON schema of a result schema. |
ztcl::agent post URL HEADERS BODY |
One HTTP/1.1 POST of a JSON body. Gives status N body TEXT. |
Examples
package require ztcl::agent; ztcl::agent check {n int tags {list string}} {n 3 tags {a b}}givesn 3 tags {a b}catch {ztcl::agent check {kind {enum a b}} {kind c}} msg; set msggivesresult.kind is not enum a bproc greet {name {times 1}} {}; lindex [ztcl::agent describe greet] 3gives{name required} {times optional}ztcl::agent schema {n int}gives{"type":"object","properties":{"n":{"type":"integer"}},"required":["n"],"additionalProperties":false}
Facts
- Capability:
thread. A new interpreter does not have this command. See Limits and capabilities. - Compute cost: one compute unit for the call, and more for the commands that it runs.
- The full page: ztcl::agent.