Liking cljdoc? Tell your friends :D

Tools and HTTP API

Workspace tools

Module: im.ttalk/clj-agent-tools

Source: modules/clj-agent-tools/src

Namespace: im.ttalk.agent.tools

(require '[im.ttalk.agent.tools :as tools]
         '[im.ttalk.agent.tools.exec :as exec])

(def workspace
  (tools/workspace
    {:root "/absolute/path/to/project"
     :exec {:backend (exec/local-backend)}}))

(def agent-tools
  (tools/workspace-tools
    workspace
    {:groups #{:files :edit :delete :exec :notes}}))
GroupTools
:filesread_file, list_dir, glob, grep
:editwrite_file, edit_file, apply_patch
:deletedelete_path
:execexec, exec_command, write_stdin
:web-fetchweb_fetch
:skillskill
:notesnotes_list, notes_read, notes_write

Mutating and execution tools are sensitive by default and participate in the normal approval mechanism. preview uses the same planning function as execution, so an approval prompt can show the exact diff without applying it. close! ends exec sessions and releases workspace resources.

Execution is intentionally sandbox-agnostic. Wrap the command runner with im.ttalk.agent.tools.exec/argv-prefix-backend when your deployment requires bubblewrap or another external isolation command.

Standalone HTTP client

Module: im.ttalk/clj-http

Source: modules/clj-http/src

Namespace: im.ttalk.http

This module is independent of clj-agent's model classes and has no third-party dependencies beyond Clojure. It exposes Ring-shaped request/response maps on top of java.net.http.

(require '[im.ttalk.http :as http])

(http/request
  {:method :post
   :url "https://api.example.com/items"
   :headers {"Authorization" "Bearer ..."}
   :body "{\"name\":\"example\"}"
   :timeout-ms 30000})

(http/request-async {:url "https://api.example.com/health"})
FunctionPurpose
client / default-clientBuild or reuse an HttpClient
request / request-asyncSynchronous or future-based request
stream-linesLine-by-line streaming with first-byte and idle watchdogs
header / header-values / media-typeCase-insensitive header access
query-string / with-query / url-encodeURL query helpers
success? / timeout-error?Response and watchdog predicates

SSE parsing lives in im.ttalk.http.sse; proxy, failure, and HTTP-date helpers live in .proxy, .failure, and .date. JSON encoding and retry policy are caller concerns in this standalone module.

Can you improve this documentation?Edit on GitHub

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