/iblai-vibe:iblai-api-agent-sessionfrom ibl.ai vibe
Drives a deployed ibl.ai agent via raw REST/SSE/WebSocket chat transport and manages sessions. POST prompts with metadata or document_filter, stream replies, list/read sessions, and expose client tools.
Ships in ibl.ai vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Drive a deployed agent's chat transport directly and read its sessions.
Where /iblai-api-agent-chat wires a hosted MCP server for conversation, this
skill is the raw REST/SSE (and WebSocket) surface: POST a prompt, stream the
reply, attach metadata that resurfaces as client_context, and list/inspect
the resulting session records. Get IBLAI_ORG/IBLAI_USERNAME/IBLAI_API_KEY
from /iblai-api-login.
Authorization: Api-Token $IBLAI_API_KEY on every request.{org} = $IBLAI_ORG, {user} = $IBLAI_USERNAME.https://asgi.data.iblai.apphttps://api.iblai.app/dm/api/ai-mentor/orgs/{org}/users/{user}/v1 … i.e. …/orgs/{org}/users/{user}/sessions/…/iblai-api-login first.Two independent context fields — one soft, one hard. A chat turn can carry both
metadata (soft) and document_filter (hard); they do different jobs and don't
substitute for each other:
metadata (soft) — steers how the agent reasons. It's appended to the prompt and
persisted; it never restricts which documents RAG can retrieve.document_filter (hard) — steers which documents RAG may retrieve. It's a
document-level allow-list applied in the vector store; it does not touch the prompt.Passing metadata alone narrows nothing in retrieval; passing document_filter alone
scopes retrieval without giving the agent any extra prose context. Use both when you want
both effects.
metadata → client_context passthrough (soft). Every chat turn (WS or SSE) may
carry a metadata object of arbitrary key/values (BaseConsumerPayload.metadata). The
runner folds it into the prompt the agent sees, so the agent can tailor its reply, and the
consumer persists it on the session as Session.metadata["client_context"]. It is
session-level: each turn's metadata overwrites the session's client_context, so
it sticks across turns until you send new keys. Use it to tell one deployed agent
where/why a message arrives (product, plan tier, page, region) without editing its
prompt. It then echoes back on every read below. The sibling field page_content is
also appended to the prompt, but — unlike metadata — is stripped before the message is
saved.
document_filter → retrieval scoping (hard). An optional
BaseConsumerPayload.document_filter object ({key: scalar}) restricts RAG retrieval to
documents whose ingested custom_metadata is compatible with the filter. It is matched
inclusively per key: a document is kept if, for every filter key, it either
matches that key's value or does not carry that key at all; it is excluded only
when it carries the key with a different value. Multiple keys are AND'd. Because a
document that lacks a key is never excluded by it, generic/untagged material always
survives — e.g. {"stateCode":"CA"} keeps California docs and generic docs that carry
no stateCode, while dropping docs tagged for other states. Unlike metadata,
document_filter is not session-sticky — it applies only to the turn that sends it —
and it never appears in the prompt or saved history. It only shrinks the retrieval
candidate set; top-k similarity ranking still runs afterward, so an eligible document is
not guaranteed to be retrieved if higher-scoring eligible documents fill the top-k.
client_tools → tools the client runs. A turn may also carry client_tools:
OpenAI-style function definitions for tools that run on the user's machine (read_page,
click). When the agent calls one, the stream carries a client_tool_call frame; the
client runs the tool and posts the output to /v1/chat/tool-results, and the agent continues
on the same turn. The agent must have enable_client_tools on, the definitions are sent
on every turn that may use them (nothing is stored on the session), and an unanswered call
fails after at most 300 seconds. Frame shapes, limits and status codes:
references/client-tools.md.
…/dm/api/ai-mentor/orgs/{org}/users/{user}/sessions/ — list the user's
chat sessions.…/orgs/{org}/users/{user}/sessions/{session_id}/ — the session's paginated
chat messages (MessageView); the response also carries client_context, read from
the session's metadata["client_context"].…/orgs/{org}/users/{user}/sessions/{session_id}/tasks/{task_id}/ — the
chat-history export (DownloadableChatHistory); every item carries a client_context
field. Add ?to_csv=true for a CSV whose columns are exactly
type,content,timestamp,client_context. Kicking off (POST) and polling that export
task is owned by /iblai-api-agent-history.summary.client_context from
GET …/dm/api/analytics/messages/details/?platform_key={org}&session_id={session_id}
— documented under /iblai-api-analytics.https://asgi.data.iblai.app/api/agent/chat/?platform_key={org}&session_id={session_id}
— send a chat turn; response is Server-Sent Events. Body (BaseConsumerPayload):
{
"session_id": "…",
"prompt": "Hello",
"flow": { "name": "<agent unique_id>", "tenant": "<org key>" },
"page_content": "optional text appended to the prompt, stripped before saving",
"metadata": { "any": "soft client context keys" },
"document_filter": { "stateCode": "CA" },
"client_tools": [
{ "type": "function", "function": { "name": "read_page", "description": "…", "parameters": { "type": "object", "properties": {} } } }
]
}
session_id (a UUID4) and flow are required; flow.name selects the agent (its
unique_id, or a slug/name) and flow.tenant is the org key. prompt and
page_content default to empty, metadata and document_filter to null. metadata is
soft passthrough — stored on the session as client_context (see Concepts) and echoed in
the reads above. document_filter is the hard retrieval scope — an inclusive per-key
allow-list over documents' ingested custom_metadata, applied only to this turn and never
persisted (see Concepts and Schema). client_tools is optional and defaults to null;
the turn is refused with a 400 error frame when the agent's enable_client_tools is
off. The same payload works over WebSocket at wss://asgi.data.iblai.app/ws/chat/.https://api.iblai.app/dm/v1/chat/tool-results — return the
output of a client tool the agent called. Body:
{
"generation_id": "from the client_tool_call frame",
"tool_call_id": "the frame's id",
"output": "text, at most 256 KB",
"is_error": false
}
200 {"detail": "Accepted"}; 404 when no call of yours is waiting under that id
(timed out, finished, or not yours); 409 when it was already answered. Post with the
credential that started the turn.…/dm/api/ai-mentor/orgs/{org}/users/{user}/sessions/ — create/retrieve a
session (ChatSessionView; the body's mentor field picks the agent). Or let the
first chat turn create one by passing a new session_id.# Stream a chat turn with attached client context (SSE). MENTOR = the agent's unique_id.
curl -N -X POST \
"https://asgi.data.iblai.app/api/agent/chat/?platform_key=$IBLAI_ORG&session_id=$SESSION" \
-H "Authorization: Api-Token $IBLAI_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"session_id":"'"$SESSION"'","prompt":"Summarize my notes","flow":{"name":"'"$MENTOR"'","tenant":"'"$IBLAI_ORG"'"},"metadata":{"source":"docs","tab":"notes"}}'
# Read the session's messages back (client_context is the metadata you sent)
curl "https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/sessions/$SESSION/" \
-H "Authorization: Api-Token $IBLAI_API_KEY"
# Download the history export as CSV (client_context is a column)
curl "https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/sessions/$SESSION/tasks/$TASK/?to_csv=true" \
-H "Authorization: Api-Token $IBLAI_API_KEY"
/api/agent/chat/, /ws/chat/) is on
asgi.data.iblai.app; session reads are ordinary REST on the api.iblai.app/dm
gateway. session_id and flow are required on every turn, and flow.name must
resolve to a deployed agent (its unique_id, slug, or name)./iblai-api-inference; to chat via an MCP server instead of raw SSE, use
/iblai-api-agent-chat; the history-export task (kick off + poll) is
/iblai-api-agent-history; the summary.client_context analytics read is
/iblai-api-analytics.metadata / client_context (soft) — an arbitrary JSON object (dict[str, Any] | null, BaseConsumerPayload.metadata). No fixed keys; use whatever your app needs, e.g.
product, planTier, userRole, region. Sent as metadata on a chat turn, it is
persisted at Session.metadata["client_context"] and read back as client_context in
the session-messages response, the history export (a client_context field per item, or
CSV column via ?to_csv=true), and analytics summary.client_context. It is appended to
the prompt but never restricts retrieval.
document_filter (hard) — an optional JSON object (dict[str, str|int|float|bool] | null, BaseConsumerPayload.document_filter) that scopes RAG retrieval to documents whose
ingested custom_metadata is compatible with the filter. It never touches the prompt and
is not persisted on the session (per-turn only). The keys/values here match the
custom_metadata you attach when adding documents — see /iblai-api-agent-dataset for
tagging documents at ingestion (the custom_metadata field on documents/train/).
^\w+$) — no __, no ORM-style
lookup suffixes (__icontains, etc.). Values must be scalars (string, number, or
boolean); lists/objects/null are rejected. A malformed filter fails the turn with a
validation error rather than being silently ignored."CA" ≠ "ca";
the integer 2026 ≠ the string "2026"), and keys are matched exactly ("stateCode" ≠
"statecode"); a key no document carries acts as a no-op for that key.stateCode = <state>; then {"stateCode":"CA"} retrieves
California and generic documents while excluding other states — no per-state agent or
two-stage retrieval needed. To search everything, send no document_filter (an empty
or fully non-matching filter can yield an empty candidate set, and the agent may then
answer without any retrieved context).k if broad generic
material is being crowded out.references/client-tools.md — tools the client runs:
the client_tools definition and its limits, the client_tool_call frame, the
/v1/chat/tool-results endpoint and its status codes, timeouts and stop, and every reason
a turn that sends client_tools is refused.references/metadata-passthrough.md — the
metadata pass-through companion: the <CONTEXT METADATA> prompt-injection format,
per-transport wire notes (SSE/WebSocket + the embedded-iframe postMessage channel),
session caching (send-once, replace-not-merge, ~2h TTL), the
one-agent-many-contexts pattern, the storage/pipeline map (session
client_context vs. the per-message snapshot), and the soft metadata vs. hard
document_filter comparison with the state-specific + generic retrieval pattern.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub iblai/base --plugin iblai-vibe166 skills in this plugin
/iblai-api-agent-accessManage role-based access to an ibl.ai agent via the platform API — list role policies, search users/groups, and grant/revoke editor, chat, or analytics_viewer roles for users, groups, and emails. Use when controlling who can edit, chat with, or view analytics for an agent./iblai-api-agent-auditRead an ibl.ai agent's audit log via the platform API — a who-changed-what trail filterable by action, actor email, and date range. Read-only. Use when investigating configuration changes to an agent./iblai-api-agent-chatSet up live chat with a deployed ibl.ai agent by wiring the hosted iblai-api-agent-chat MCP server into the project (.mcp.json / claude mcp add) using the .env Api-Token and a chosen agent's unique id, or by signing in from claude.ai, ChatGPT or Claude Desktop with only the URL. Use to enable runtime conversations with an agent, and to list or disconnect the apps a user has connected. The actual chatting then happens through the MCP server's tools./iblai-api-agent-createCreate a new ibl.ai agent from a template via the platform API — set name, display name, description, categories, visibility, prompts, and LLM provider; returns the new agent's unique id. Read which create fields the caller may write (field-permissions) first, since a create that sends a forbidden field is refused. Use when creating an agent from scratch, checking what a user may set when creating one, then configure it with the other /iblai-api-agent-* skills./iblai-api-agent-datasetManage an ibl.ai agent's training datasets (RAG) via the platform API — list training docs, add resources (file, URL, YouTube, Blackboard, website crawl, GitHub), train/untrain, set visibility and retrain schedule, and delete. Use when feeding an agent knowledge./iblai-api-agent-disclaimerManage an ibl.ai agent's disclaimers via the platform API — the Advisory text (saved through the agent settings endpoint), the User Agreement (create/update/activate), and the record of who accepted it. Use when adding legal or advisory notices users must see or accept, or auditing acceptances.Other plugins' skills for the same job