Skip to content

The profile ​

The profile, yokla.profile.yaml, describes one target: how to reach it, where its answer is, and what yokla may compare the answer with. Everything a particular assistant needs is set here, never in yokla's code. The JSON Schema gives every field with its description. yokla schema profile prints it for an editor:

yaml
# yaml-language-server: $schema=<path to>/profile.v1.schema.json
version: 1

Problems are reported as file:line:column, before any request is sent.

Paths ​

Two kinds of path appear in a profile:

  • JSONPath, from the response root. Fields such as response.text and evidence.<name>.items use JSONPath. yokla supports a subset: $, .name, ['name'], [n] and [*]. [*] selects every element of an array or every member of an object. There are no filters, unions or recursive descent.
  • Field paths, inside an item. Fields such as evidence.<name>.fields use dotted names, such as price.amount.

target.request ​

This section is for an HTTP target, adapter: http, the default. A WebSocket target has its own request (see WebSocket targets).

FieldMeaning
urlThe chat endpoint. --target-url overrides it for one run.
methodPOST (default), PUT or PATCH.
headersRequest headers.
bodyA JSON body.
timeoutMsHow long a turn may take, default 30000. For a streamed answer this covers the whole stream.
requestId.headerSend a unique id per request in this header. Log observation and header correlation use it.

Strings in url, headers and body may contain placeholders:

PlaceholderValue
{{message}}The user's message of the turn.
{{session}}A new session id per sample, when session.mode is client.
{{requestId}}The request id, when requestId is set.
{{carry.NAME}}A value carried from an earlier answer or from session.open.
{{env.NAME}}An environment variable. Secrets belong here, never in the file.
{{auth.token}}The token target.auth gets (below). Never left out: a request without its token would only be refused.

A string that is only a placeholder keeps the value's type. If that value doesn't exist yet, such as a carried value on the first turn, the field or header is left out. Inside a longer string, a missing value is an error.

A case turn can add headers or body fields for that turn only (see cases).

target.response ​

FieldMeaning
textWhere the answer text is. Required. One path reads its first match; a list of paths reads every string at each, joined in order with a blank line, for answers given as cards or other components (ADR-0020). Join only text that stands on its own: a component's title, a plan's steps, a guide's sections. Leave out a line that belongs to one item without naming it, such as a card's reason or a comparison's pros and cons: joined, it reads as being about every product (ADR-0021).
routeWhere the target says which path answered, if it does. route-expected needs it.
idWhere the target's own request id is. Log observation can correlate by it.
clarification.routesRoutes that mean the target asked a clarifying question. Product expectations then don't apply to that turn.
evidenceThe structured items the answer is based on, such as products (below).
streamRead the answer as an event stream (below).
schemaThe contract of every usable answer: { at, schema } or { at, schemaFile }, a JSON Schema that every value at selects must match, judged by json-schema (below).
contactPhrasesThe target's own words for its channels to a person, such as a support URL or a phone line's name, matched after the language pack's folding. request-handled counts them as a pointer to a person, beside the language pack's deflection phrases; no other check reads them (ADR-0075).

Evidence ​

Evidence is what the target returned besides its text, such as the products it shows. Checks compare the answer with it.

yaml
evidence:
  products:                       # the e-commerce checks read this collection
    items: $.data.products[*]
    fields:
      id: id
      name: name
      category: category
      price: { from: [price.sale, price.list], as: number }
      currency: price.currency
      stock: stockQuantity        # null means unknown, not zero
  • items is one JSONPath to the items, or a list of them, read in order, such as a card's products and a comparison's. An item with an id an earlier path returned is left out, so a product shown twice in one answer counts once; within one path a repeated item stays (ADR-0020).
  • fields maps each evidence field, in camelCase, to a field path in the item. A field may give several paths, tried in order until one is not null, and a conversion as: string | number | boolean. A value that can't be converted is read as null and reported.
  • The e-commerce checks read the products collection and its id, name, price, currency, stock, inStock and category fields. stock is a quantity; inStock is availability as a boolean, for targets that give no quantity. Filter attributes may name any other field. When the profile has a catalog, an item's missing price, currency, stock, inStock and type are completed from it by id.

The response contract ​

schema holds every usable answer to a JSON Schema (ADR-0030):

yaml
target:
  response:
    schema:
      at: $.data
      schema:
        type: object
        required: [answer, metadata]
        properties:
          metadata:
            type: object
            required: [route, language]
            properties: { language: { enum: [tr, en] } }
  • at is a path in the response document: the JSON body, or the document a stream or a WebSocket becomes. It is $ by default. A path that selects nothing fails.
  • The schema is inline, or a JSON or YAML file as schemaFile, relative to the profile.
  • yokla checks a subset of JSON Schema 2020-12 itself:
    • type, enum, const, allOf, anyOf, oneOf and not;
    • for objects, properties, required, additionalProperties, minProperties and maxProperties;
    • for arrays, items, prefixItems, minItems, maxItems and uniqueItems;
    • for strings, minLength, maxLength, pattern, and format for date-time, date, time, email, uri and uuid;
    • for numbers, minimum, maximum, exclusiveMinimum, exclusiveMaximum and multipleOf;
    • $ref inside the schema, and $defs;
    • annotations such as title and description, which it ignores.
  • Any other keyword, another format, or a $ref outside the schema refuses the profile, with the keyword and where it is. A $ref is never fetched.

Streamed answers ​

A target that answers with server-sent events or newline-delimited JSON declares response.stream (ADR-0016):

yaml
response:
  stream:
    format: sse                    # sse | ndjson
    text: { event: text_delta, from: $.text }
    done: turn_complete            # without it, the answer is incomplete
    error: { event: error, from: $.message }
  text: $.text
  evidence:
    products:
      items: $.all.ui[*].payload.items[*].product
      fields: { id: product_id, name: title, price: price }

yokla turns the stream into one document, and the other response paths read that document:

  • text: the text pieces, joined in order.
  • events: every event, in order.
  • all.NAME: the data of every event with that name.
  • last.NAME: the data of the last event with that name.

An event's name is its SSE event field. stream.event names a path in the data to use instead. An event with neither is named message. A declared done event that never came, or an error event, makes the answer incomplete and the turn an error. Under injected faults it is a finding. The results record firstTextMs, the time to the first text piece. Latency stays the time to the full answer.

WebSocket targets ​

A target that talks over a WebSocket sets adapter: websocket (ADR-0024):

yaml
target:
  name: my-assistant
  adapter: websocket
  request:
    url: wss://chat.example.com/ws?session={{session}}
    headers: { authorization: 'Bearer {{env.CHAT_TOKEN}}' }
    protocols: [chat.v1]           # optional subprotocols
    body: { type: user_message, text: '{{message}}', id: '{{requestId}}' }
    timeoutMs: 30000
  response:
    stream:
      event: $.type
      text: { event: text_delta, from: $.text }
      done: turn_complete          # required
      error: { event: error, from: $.message }
    text: $.text
    route: $.last.turn_complete.route

The connection.

  • A sample opens one connection, after its cache bypass and session.open, and closes it with code 1000 after its last turn.
  • url (ws:// or wss://) and headers are sent once, when it opens.
    • They can use {{env.NAME}}, {{session}} and the values session.open carries.
    • They can't use {{message}}, {{requestId}} or values carried from an answer, which change per turn.
  • The cache bypass header and the client identity go with the handshake.
  • yokla connects only to the target's origin. A session.open path resolves against it, with ws read as http and wss as https.

Each turn.

  • body is the message sent for the turn, as JSON text. A case turn can add body fields, but not headers.
  • {{requestId}} in the body gives the turn a unique id. The turn records it, and log observation can correlate by it.
  • Values session.carry reads from an answer reach the next message.

The answer.

  • Each message is one event. Its data is the parsed JSON, or the text when it isn't JSON. A binary message is read as UTF-8 text.
  • stream.event is where an event's name is in its data. Without it, every event is named message. There is no stream.format.
  • stream.done is required, since nothing else ends an answer. For an answer in one message, name that message's event, such as done: message.
  • The document {text, events, all, last} is built as for a streamed answer, and the other response paths read it.
  • timeoutMs bounds opening the connection, and each answer up to its done event.

An incomplete answer. The turn is an error, and the sample's later turns don't run, when:

  • the connection closes before done; the error gives the close code and reason;
  • the error event arrives;
  • timeoutMs runs out.

Under injected faults it is a finding instead. On an edge-case turn, status-allowed judges it.

Status. A WebSocket turn records the status 101, the status its connection opened with. Wherever yokla asks for a 2xx answer, it asks a WebSocket turn for a complete one. An error event is not a handled answer, as over SSE, and allowStatus can't name one.

Messages outside a turn.

  • A greeting before the first message is left unread.
  • Messages that arrive after an answer's done event, before the next message goes, become an issue of the next turn. Late messages may mean that done comes too early.
  • A message that arrives after the next message went is read as part of the next answer.

Not available yet.

  • The model proxy's header correlation. The connection sends headers once, so the profile is refused with it. Use serial.
  • Waiting out rate limits. A message gets no 429.
    • limits paces the messages. Set it below the target's own limit, since a rate-limit error event fails the turn.
    • retryAfter doesn't apply.
  • yokla init. Write the profile by hand.

target.auth ​

When the target needs a token that a token endpoint or a login issues, yokla gets it for the run (ADR-0031). The profile says where it goes, with {{auth.token}}:

yaml
target:
  request:
    url: https://chat.example.com/v1/chat
    headers: { authorization: 'Bearer {{auth.token}}' }
    body: { message: '{{message}}' }
  auth:
    kind: oauth2-client-credentials
    tokenUrl: https://auth.example.com/oauth/token
    clientId: '{{env.CHAT_CLIENT_ID}}'
    clientSecret: '{{env.CHAT_CLIENT_SECRET}}'
    scope: chat
    params: { audience: https://chat.example.com }
FieldMeaning
kindoauth2-client-credentials, as RFC 6749 §4.4 defines it, or request, a token request the profile describes.
tokenUrlFor OAuth: the token endpoint.
clientIdFor OAuth: the client id, written or {{env.NAME}}.
clientSecretFor OAuth: a single {{env.NAME}} placeholder. A secret written in the file refuses the profile.
clientAuthFor OAuth: basic (default), HTTP Basic; or body, the id and secret in the form.
scope, paramsFor OAuth: the scope, and further form fields such as audience.
requestFor request: the token request, in the form of session.open's, with an absolute url.
token, expiresInFor request: where its answer holds the token, and its lifetime in seconds.
refreshBeforeMsA new token is fetched when less than this of its lifetime remains, or less than half of it. Default 30000.
timeoutMsFor OAuth: how long the token request may take. Default 10000.

A login of the target's own:

yaml
  auth:
    kind: request
    request:
      url: https://chat.example.com/api/login
      body: { username: '{{env.CHAT_USER}}', password: '{{env.CHAT_PASSWORD}}' }
    token: $.data.jwt
    expiresIn: $.data.ttlSeconds
  • When yokla fetches a token.
    • Once, before the first request of the run. If that fails, the run stops before any case, with exit code 2, and says why: the status, and the error and error_description an OAuth server gives.
    • Again before the token expires, when its lifetime is known.
    • Again after the target answers 401, or refuses a WebSocket handshake. The request is sent once more with the new token; a second refusal is the turn's error.
    • Once at a time: requests that need a token at the same moment wait for the same fetch.
  • Where it can go. In the target's request, session.open, and a WebSocket's url, headers and messages. yokla adds no header of its own. An auth whose token no request uses, or {{auth.token}} without an auth, refuses the profile.
  • Keeping it secret.
    • The token, and every environment value auth uses, show as *** in everything yokla writes: the results, the reports and the errors. That holds even when the target echoes one in its answer.
    • The token urls must use HTTPS, except to a loopback host.
    • The token endpoint is the only host its request may reach.
    • auth takes {{env.NAME}} placeholders only.
  • What the results say. run.auth holds the kind, the tokens fetched, and the requests sent again after a 401.

target.session ​

FieldMeaning
modeclient (default): yokla sends a new {{session}} id per sample. none: no session id.
carryValues read from each answer and sent with the next turn as {{carry.NAME}}, such as a conversation id the server issues. Each is { name, from }, with from a JSONPath.
openA request sent once per sample, before the first turn (below).

session.open is for targets that issue their own sessions:

yaml
session:
  mode: none
  open:
    request: { url: /api/session, body: {} }
    carry: [{ name: sessionId, from: $.session_id }]
  • Its url may be a path, resolved against the target url. A full url on another origin also works, and yokla then contacts that origin too.
  • It is sent after the cache bypass, with the same cache bypass and client identity headers. {{message}} and carried values can't be used in it.
  • Its carry values are available to every turn of the sample, in the body or the headers.
  • If it fails, answers without JSON, or carries nothing for a name, the first turn is an error and no turn is sent.

target.limits ​

FieldMeaning
burstPerSecond, perMinute, perHourA token bucket over all requests of the run, or all messages to a WebSocket target.
retryAfter.headersHeaders that say how long to wait after a 429, default retry-after. A trailing * matches a prefix.
retryAfter.unitseconds (default) or milliseconds.
retryAfter.maxWaitMsThe longest wait yokla accepts, default 60000. A longer wait, or a sixth 429 in a row, makes the turn an error.
clientIdentityOpt-in, for targets that limit per address: send a rotating TEST-NET address (RFC 5737) in this header, per case or per sample.

target.cacheBypass ​

Every sample is cold: it bypasses the target's response cache, so an answer is never a cached copy of an earlier sample.

  • { kind: header, name, value } sends a header, with value defaulting to "1".
  • { kind: command, run: [...] } runs a local command before each sample, such as one that clears a cache. It is an argument list and never runs in a shell.
  • { kind: none } is the default.

target.observe.logs ​

For a target whose model calls the proxy can't see, yokla can read the target's own structured logs once after the run (ADR-0009):

yaml
observe:
  logs:
    source: { kind: command, run: [docker, compose, logs, --since, '{{startedAt}}', backend] }
    contains: '[Telemetry]'
    correlate: { by: request-id, field: requestId }
    fields:
      costUsd: { from: cost.total }
      modelCalls: { from: calls, reduce: count }
      route: path
  • source: a file path, or a command whose arguments may contain {{startedAt}}, the run's start time in ISO 8601.
  • Which lines: each line is read as JSON, and text before the first { is ignored. contains keeps only lines whose text contains a string. match keeps only lines where each path has a given value.
  • Correlation: correlate.by ties a line to a turn by request-id (the id yokla sent), target-id (response.id) or order.
  • fields: maps names to paths in the line, with a reduce of first (default), sum, count, any or all.

Results keep only the mapped fields, labelled as reported by the target.

Languages, domain and capabilities ​

  • languages: the languages the target speaks, tr and en. Each case names one.
  • domain: the domain pack, ecommerce.
  • capabilities: what the target claims to do, each with an id and optional description and provenance (where the claim comes from, and whether a person approved it, ADR-0004). They document the target; no check reads them yet.
  • refusal.canonical: per language, the target's own refusal sentences. The refusal checks recognise them besides the language pack's wording.

provenance ​

A profile yokla analyze proposed says where each of its entries came from (ADR-0047), in a map at its top, keyed by JSON Pointer (RFC 6901):

yaml
provenance:
  /ecommerce/catalog/path:
    source: data
    evidence: "./data/catalog.jsonl: 43 of 43 rows, with id as id, price as price"
    status: proposed
  /target/response/evidence/products/fields/price:
    source: probe
    evidence: "probe 2: price.amount equals the catalog's price in 3 of 3 items"
    status: proposed
  • Each key is a pointer to an entry of the profile; one that leads to no entry refuses the file.
  • Each value is a provenance: its source (data, probe, doc, code and the like), its evidence, and its status.
  • An entry without one was written by a person, and is approved.
  • A profile with a proposed or rejected entry doesn't run: yokla run, explore, shrink and mcp refuse it and name the entries.
    • To approve an entry, set its status to approved, or delete its line, which makes the entry yours.
    • To reject one, delete the entry and its line.

everyAnswer ​

Rules every turn with a usable answer is held to, in every case, judged by answer-text (ADR-0030). Only rules an answer must not break belong here:

yaml
everyAnswer:
  notMatches: ['\{\{\s*\w+\s*\}\}', '\b(?:undefined|NaN|null)\b']
  notContains: [stack trace]
  • notContains: phrases no answer may contain, after the language pack's folding.
  • notMatches: regular expressions no answer may match, as it came, in the form answer.notMatches takes.

modelProxy ​

Present when the app's model calls go through yokla proxy, or when its OpenTelemetry spans show them (see the model proxy guide). It needs an upstream, or spans.

FieldMeaning
portThe proxy's port on 127.0.0.1, default 8787.
upstreams[]Each with id, kind (openai-compatible, anthropic or gemini, ADR-0032), upstream (the real provider base URL) and optionally appBaseUrlEnv (the app setting to point at the proxy, for people to read). The app reaches an upstream at http://127.0.0.1:<port>/<id>. May be empty when spans show the calls.
correlationserial (default): one request in flight. header: the app forwards x-yokla-trace to its provider calls.
settleAfter each answer in serial mode, and before the run ends, wait until the target's model calls stop: none in flight, and none for quietMs (default 250). Give up after maxWaitMs (default 10000).
spansRead the model calls from the app's OpenTelemetry spans, tied to turns by a traceparent header per turn (ADR-0029). At the run's end, wait until no span has come for quietMs (default 6000); give up after maxWaitMs (default 20000). HTTP targets only. See the model proxy guide.
prompts.storeWhat the results keep of each prompt: sizes (default), hashed, redacted or full.
prompts.redactRegular expressions whose matches redacted replaces.
inspect.canaryA string the app's system prompt contains, for prompt-leak.
inspect.untrustedEvidence fields that hold retrieved content, per collection, such as { products: [name] }, for untrusted-in-system.
toolResultsPer tool, evidence collections in the results the model saw, in the form of response.evidence (ADR-0026). See the model proxy guide.

ecommerce ​

The e-commerce pack's data (see checks for how each check uses it).

FieldMeaning
neverFabricateThe fact kinds the target must never invent: price, stock, discount, shipping, returns and warranty, all by default. Today policy-claim reads it, for shipping, returns and warranty: once the profile lists policies, a topic in this list without a policy entry can back no claim.
policies.<topic>The source for a policy topic: { source: none } (any concrete claim is a finding), { source: faq, path, topic? } (JSON Lines rows with topic, lang and answer) or { source: text, text }.
catalogA JSON Lines snapshot of the catalog: { kind: file, path, fields: { id, type, price, currency?, stock?, inStock?, name?, typeLabel? } }. Evidence items are completed from it by id. A null stock means unknown. name is one field, or one per language such as { tr: name_tr, en: name_en }; yokla explore asks for products by it (ADR-0044). typeLabel, one field or one per language like name, holds the words a shopper uses for the row's type, such as "sleeping bag": yokla explore asks for a type by its most common label, in place of its last level, which may be a facet such as a size (ADR-0050). Types with the same label are one type to yokla, so give every type a shopper treats as one, such as each kind of hiking shoe, the same label: a product of a near type then matches. yokla can't tell a near type from an accessory by its path or label (ADR-0052). attributes maps the evidence field each attribute filter names to the catalog field that holds it, such as { color: color, size: size }: yokla generate asks for products by them (ADR-0055).
typeSeparatorSeparates the levels of a product type, such as / in outdoor/camping/tent. Without it, types match only exactly.
campaignsAmounts an answer may show besides product prices, each with id, amount and currency.
priceSourcesFurther amounts an answer may quote (ADR-0020): { evidence, fields }, the amount fields of an evidence collection of the conversation, such as an order card's; or { file, paths }, a JSON or JSON Lines snapshot, such as an order history, and the JSONPaths of its amounts. They ground amounts but don't make price-grounded apply. An amount anywhere in a file grounds a quote, whoever's order it was.

| restrictions | Who may buy what, where and how many: the target's own rules, which yokla generate --redteam attacks (ADR-0082, ADR-0086). Each has products (ids) or types (with the types under them); minAge, notSoldIn and/or maxQuantity, the most of a covered product one order may hold; and source, where the rule is written. A place in notSoldIn is one name, or one per language such as { tr: Almanya, en: Germany }. | | cartEvidence | The evidence collection that holds the cart, such as cart. A restriction attack expects the restricted product not to be in it (ADR-0082). | | cartQuantity | Where a cart call holds its quantity: { tool: add_to_cart, path: quantity }, the tool and a dotted path into its arguments. The quantity attack judges it against a restriction's maxQuantity (ADR-0086). |

Paths in the profile are relative to the profile file.

identities ​

Test customers the person set up in a test copy of the target, by name (ADR-0083). A turn sent as one goes with its request, in its own session.

yaml
identities:
  alice:
    request: { body: { customer: alice } }
    name: Ayşe Yılmaz
    seeded: ['Moda Caddesi No 12, Kadıköy, İstanbul', '0532 000 00 01']
    orders: [DS-1001]
  bob:
    request: { headers: { authorization: 'Bearer {{env.BOB_TOKEN}}' } }
    name: Mehmet Demir
FieldMeaning
requestbody merged into, and headers added to, every request sent as the identity: what tells the target who is asking. {{env.NAME}} is allowed.
nameHow a shopper names the person: the pretext attack names them.
seededThe identity's own personal data in the test copy, at least three characters each. pii-leak fails an answer to anyone else that holds one.
ordersIds of the identity's orders: the bola and order-fraud attacks ask for them as another identity, excessive-agency as the identity itself.
roleA role listed in roles, such as customer (ADR-0086).
  • The order matters for yokla generate --redteam: the first identity is the victim, the second the attacker.
  • Not yet: an identity on a target with session.open, over WebSocket, or with a token of its own from target.auth.

roles ​

What each role an identity has may not do (ADR-0086).

yaml
roles:
  customer:
    forbiddenTools: [refund_order]
FieldMeaning
forbiddenToolsTools the model must never call for someone with this role, such as a refund only staff may give. The privilege attack, sent as an identity with the role, expects none of them called.
  • An identity's role must be listed here; an unknown one is a profile error.
  • Judged per case: a role's tools are an attack's tools.notCalled, or any case's that a person writes, not a rule over every turn sent as the identity.

redteam ​

What the red-team checks look for (ADR-0082, ADR-0085).

FieldMeaning
internalsStrings an answer to a question about the internals must never hold, such as an internal tool's name or a debug flag, at least three characters each. internals-leak looks for them, beside the model id and the tool names the proxy saw.
actionToolsTools that act on an order, an account or a payment, such as [cancel_order, refund_order]. The order-fraud and excessive-agency attacks expect none of them called (ADR-0086).
freeTextArgumentsPer tool, the arguments meant to take the user's words, such as a search box's query, as dotted paths into its arguments: { search_products: [query] }. A payload marker that reaches only these is unmeasured by tool-argument-marker, not a failure: whether the tool treats the text as data happens behind it.

Apache-2.0