Skip to content
AGNT
All guides

curl, jq, and a handful of shell functions — everything you need to drive the AGNT Open Network without writing a single line of application code.

developerintermediate

CLI workflows: driving AGNT from the terminal

curl, jq, and a handful of shell functions — everything you need to drive the AGNT Open Network without writing a single line of application code.

AGNT's Open Network is a plain HTTPS API. That means you do not need an SDK, an IDE, or a framework to work with it — just a shell. This guide is the terminal-first playbook: shell aliases, curl-plus-jq recipes, and the three most useful wrapper functions to keep in your dotfiles.

AGNT Developer Experience9 min6 sections
clicurljqbashshell

Prerequisites

  • A Unix-like shell (bash, zsh, or fish).
  • curl and jq installed.
  • An AGNT developer API key.

Shell setup

Export your key once and point your shell at the base URL:

bash

export AGNT_KEY="agnt_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AGNT_BASE="https://api.agntdot.com"

If you have multiple keys (dev, staging, prod), keep them in a .envrc that direnv loads per directory so you never accidentally run a production command in a dev shell.

The core curl + jq recipe

Every useful AGNT call is an HTTPS POST with a bearer token and a JSON body. The standard recipe:

bash

curl -sS -X POST "$AGNT_BASE/network/venues/search" \
  -H "Authorization: Bearer $AGNT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "sunset Canggu", "limit": 5}' \
  | jq '.results[] | {name, slug, score}'

The -sS flags silence the progress bar but still print errors. Piping straight into jq turns the raw JSON into a readable table. The .results[] filter iterates over each match and projects only the fields you care about.

Wrap the common calls in shell functions

Typing the full curl every time is noise. Drop these into your ~/.zshrc or ~/.bashrc:

bash

agnt_search() {
  local q="$1"
  curl -sS -X POST "$AGNT_BASE/network/venues/search" \
    -H "Authorization: Bearer $AGNT_KEY" \
    -H "Content-Type: application/json" \
    -d "$(jq -nc --arg q "$q" '{query:$q, limit:5}')" \
    | jq .
}

agnt_ping() {
  curl -sS "$AGNT_BASE/network/ping" \
    -H "Authorization: Bearer $AGNT_KEY" | jq .
}

Now agnt_search "sunset Canggu" is a real CLI command. The jq -nc trick safely builds the JSON body from a shell argument without you writing string escaping logic.

Streaming MCP from the terminal

AGNT's MCP server speaks Server-Sent Events. You can tail it with curl's --no-buffer flag and watch the tool list stream in:

bash

curl -N -sS "$AGNT_BASE/mcp/sse" \
  -H "Authorization: Bearer $AGNT_KEY" \
  -H "Accept: text/event-stream"

This is the fastest way to confirm the server is alive without installing an MCP client. You will see a stream of event: ... data: ... blocks — the MCP handshake, then a tools/list response as soon as the connection is established.

Quick recipes

Three patterns that come up every day in a terminal-first workflow:

  • Filter venues by tag: `curl ... /network/venues/search -d '{...}' | jq '.results | map(select(.tags[] | contains("sunset")))'`
  • Get only the first result: `jq '.results[0]'`
  • Paginate: `jq '.cursor'` and feed the next call with `-d '{..., "cursor": "<value>"}'`.
  • Save a response for replay: `curl ... | tee last_response.json | jq .` — tee writes the raw JSON to disk while still showing the pretty version.

When to graduate to an SDK

Shell + curl is unbeatable for exploration, debugging, and quick scripts. It falls short when you need structured retries, webhook verification (HMAC timing-safe comparison is awkward in bash), or a long-lived session. At that point the official SDK paths — Python, TypeScript — take over.

A common pattern on the AGNT team: curl for the first pass, SDK for the second. The first tells you what the API actually returns; the second turns the recipe into code you can ship.

Next steps

FAQ

Guide FAQ.

Common questions about this developer guide.

curl, jq, and a handful of shell functions — everything you need to drive the AGNT Open Network without writing a single line of application code.

People also ask.