When to use it
- The caller asks something the in-call agent can’t answer from its prompt (order status, account details, a policy lookup).
- You already run an agent (e.g. an internal assistant) and want phone calls to tap into it without putting it on every conversational turn.
Quickstart
consult is set, Patter auto-injects a consult_agent tool into the
agent (Realtime and Pipeline modes). The model calls it with a single
request string when it needs help.
The HTTP contract
Patter POSTs JSON to yoururl:
reply (or response / text / result /
answer / message) string, which the agent speaks:
ConsultConfig
OpenClaw (native target — no adapter)
To consult an OpenClaw agent, skip the hand-written adapter entirely:ConsultConfig.openclaw(...) speaks OpenClaw’s
OpenAI-compatible POST /v1/chat/completions gateway directly.
model="openclaw/receptionist" on the local gateway,
sends the call id as both the OpenAI user field and the x-openclaw-session-key
header (one OpenClaw session per call), reads the operator-grade bearer from
OPENCLAW_API_KEY (never logged), auto-enables allow_loopback for the
co-located gateway, and attaches a “let me check” reassurance filler. Overridable
defaults:
Enable the endpoint first. Set
gateway.http.endpoints.chatCompletions.enabled = true in
~/.openclaw/openclaw.json and keep the gateway bound to loopback. A 404 from the
endpoint means it is disabled (the consult logs an actionable hint). See the
OpenClaw integration guide for agent scoping and
deployment.
Under the hood this is a generic OpenAICompatibleConsult codec (base_url +
model + optional api_key / api_key_env / session_header), so the same
primitive drives any OpenAI-compatible gateway (vLLM, Ollama, Groq). The generic
ConsultConfig(url=...) webhook path below stays the escape hatch for custom
request/response mappings.
Pointing consult at a local agent
By default the consult URL is SSRF-validated and loopback / private / link-local targets are rejected — sohttp://localhost:8000/consult will not pass. When your
back-office agent (or a thin adapter) runs on the same machine, set
allow_loopback=True to relax that check:
- Scope. Relaxes the loopback (
127.0.0.0/8,::1,localhost), RFC1918 private (10/8,172.16/12,192.168/16), and link-local host checks for the consult URL only. The generic webhook-tool validator path — which can be reached by tool / LLM input — stays strict and is unaffected. - Always enforced. Non-HTTP(S) schemes (
file:,javascript:, …) are rejected even with the flag on. - Why it is safe. The consult URL is SDK-user configuration, not caller-derived input. Cloud-metadata hostnames also become reachable when opted in — only enable the flag for a URL you control.
Behaviour & limits
- Failure is graceful. A timeout, non-2xx response, or unreachable endpoint does not crash the turn — the agent speaks a short fallback line and carries on.
- Security. The URL is SSRF-validated; header values are never logged. The
URL is trusted SDK configuration (not caller-supplied). To point consult at a
local agent, opt in with
allow_loopback=True— see Pointing consult at a local agent. - Mode support. Injected in Realtime and Pipeline modes. ElevenLabs
ConvAI is not supported — its tools live on the ElevenLabs-hosted agent,
so a warning is emitted if you set
consultwith that provider.
getpatter for Node.
