Liking cljdoc? Tell your friends :D

repling.agent.main


agent-makeclj

(agent-make)
(agent-make initial-tools)
(agent-make initial-tools
            {:keys [project-dir sessions-root load-project-tools? runtime]
             :or {project-dir "."
                  sessions-root (session/sessions-root-default)
                  load-project-tools? false
                  runtime :jvm-eval}})

Creates a tiny agent that stores callable tools and exposes them to eval.

Supported forms:

  • []
  • [initial-tools]
  • [initial-tools opts]

opts accepts:

  • :project-dir - directory used to derive the stable session storage id. Defaults to .
  • :sessions-root - root directory where persisted sessions are stored. Defaults to (session/sessions-root-default)
  • :load-project-tools? - when true, explicitly loads .clj files from the project's .repling/tools directory after registering the initial tools. This is opt-in because loading project tool files executes trusted Clojure source from the repository.
  • :runtime - eval runtime, either :jvm-eval or :sci. Defaults to :jvm-eval.
Creates a tiny agent that stores callable tools and exposes them to eval.

Supported forms:
- `[]`
- `[initial-tools]`
- `[initial-tools opts]`

 `opts` accepts:
 - `:project-dir` - directory used to derive the stable session storage id.
   Defaults to `.`
 - `:sessions-root` - root directory where persisted sessions are stored.
   Defaults to `(session/sessions-root-default)`
 - `:load-project-tools?` - when `true`, explicitly loads `.clj` files from the
   project's `.repling/tools` directory after registering the initial tools.
   This is opt-in because loading project tool files executes trusted Clojure
   source from the repository.
 - `:runtime` - eval runtime, either `:jvm-eval` or `:sci`.
   Defaults to `:jvm-eval`.
raw docstring

string-evalclj

(string-eval agent code)

Evaluates Clojure code where registered tools are directly callable.

code must be a string.

Evaluates Clojure code where registered tools are directly callable.

`code` must be a string.
raw docstring

tool-file-load!clj

(tool-file-load! agent relative-path)

Loads one .clj project tool file from .repling/tools into the agent eval runtime.

relative-path must stay inside .repling/tools and end with .clj. If the file hits an explicit tool-name-conflict while re-registering an existing tool name, the previous registration is replaced before the file is retried.

Loads one `.clj` project tool file from `.repling/tools` into the agent eval runtime.

`relative-path` must stay inside `.repling/tools` and end with `.clj`. If the
file hits an explicit tool-name-conflict while re-registering an existing tool
name, the previous registration is replaced before the file is retried.
raw docstring

tool-file-write!clj

(tool-file-write! agent relative-path source)
(tool-file-write! agent relative-path source {:keys [load?] :or {load? true}})

Writes a .clj project tool file under .repling/tools.

Supported forms:

  • [agent relative-path source]
  • [agent relative-path source opts]

opts accepts:

  • :load? - when truthy (the default), loads the file immediately into the current agent runtime after the file is written atomically. If that load fails, the file stays on disk so the caller can inspect and fix it.
Writes a `.clj` project tool file under `.repling/tools`.

Supported forms:
- `[agent relative-path source]`
- `[agent relative-path source opts]`

`opts` accepts:
- `:load?` - when truthy (the default), loads the file immediately into the
  current agent runtime after the file is written atomically. If that load
  fails, the file stays on disk so the caller can inspect and fix it.
raw docstring

tool-lookupclj

(tool-lookup agent tool-ref)

Finds a registered tool by handle or by name.

tool-ref may be a registered var, function, Java Method, symbol, keyword, or string.

Returns tool metadata including fields like :doc, :arglists, :symbol, and :method when available.

Finds a registered tool by handle or by name.

`tool-ref` may be a registered var, function, Java `Method`, symbol, keyword,
or string.

Returns tool metadata including fields like `:doc`, `:arglists`, `:symbol`,
and `:method` when available.
raw docstring

tool-register!clj

(tool-register! agent tool-ref)
(tool-register! agent tool-name-or-class tool-ref-or-method-name)
(tool-register! agent tool-name class-ref method-name)

Registers a tool backed by a var, function, or Java method.

Supported forms:

  • [agent class-ref] for public static methods marked with @AgentTool
  • [agent tool-ref]
  • [agent tool-name tool-ref]
  • [agent class-ref method-name]
  • [agent tool-name class-ref method-name]

tool-name may be a string, keyword, or symbol. tool-ref may be a var, function, Java Method, resolvable symbol, or a descriptor map with :var or :tool plus optional :interceptors.

Registers a tool backed by a var, function, or Java method.

Supported forms:
- `[agent class-ref]` for public static methods marked with `@AgentTool`
- `[agent tool-ref]`
- `[agent tool-name tool-ref]`
- `[agent class-ref method-name]`
- `[agent tool-name class-ref method-name]`

`tool-name` may be a string, keyword, or symbol. `tool-ref` may be a var,
function, Java `Method`, resolvable symbol, or a descriptor map with `:var`
or `:tool` plus optional `:interceptors`.
raw docstring

tool-unregister!clj

(tool-unregister! agent tool-ref)
(tool-unregister! agent class-ref method-name)

Removes a registered tool.

Supported forms:

  • [agent class-ref] for tool groups discovered from @AgentTool methods
  • [agent tool-ref]
  • [agent class-ref method-name]

tool-ref may be the original handle used during registration or the registered tool name as a string, keyword, or symbol.

Removes a registered tool.

Supported forms:
- `[agent class-ref]` for tool groups discovered from `@AgentTool` methods
- `[agent tool-ref]`
- `[agent class-ref method-name]`

`tool-ref` may be the original handle used during registration or the
registered tool name as a string, keyword, or symbol.
raw docstring

tools-directoryclj

(tools-directory agent)

Returns the absolute .repling/tools directory for an agent's project.

Returns the absolute `.repling/tools` directory for an agent's project.
raw docstring

tools-filesclj

(tools-files agent)

Lists absolute .clj source files under the agent's .repling/tools directory.

Lists absolute `.clj` source files under the agent's `.repling/tools` directory.
raw docstring

tools-listclj

(tools-list agent)

Returns the registered tool metadata, sorted by tool name.

Returns the registered tool metadata, sorted by tool name.
raw docstring

tools-load!clj

(tools-load! agent)

Loads every .clj project tool file under .repling/tools in sorted path order.

Loads every `.clj` project tool file under `.repling/tools` in sorted path order.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close