> ## Documentation Index
> Fetch the complete documentation index at: https://docs.niadra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Perfil do SDK

> O que o SDK guarda no cache local: as funcionalidades ligadas, as vinculações de ferramenta da fonte, o registro de tipos resumido, o contrato de afirmação e o modo de gravação dos turnos. Com ETag.



## OpenAPI

````yaml openapi/pt/cell.json GET /v1/sdk/profile
openapi: 3.1.0
info:
  title: API de dados da Niadra
  version: '1'
  description: >-
    Escrita, contexto, histórico, objetos, identidade, privacidade e governança
    de um espaço. Cada espaço tem um endereço estável, com o espaço e a região
    no nome.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: O espaço, que vem na chave de fonte.
      region:
        default: us-east-2
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/sdk/profile:
    get:
      tags:
        - state
      summary: Perfil do SDK
      description: >-
        O que o SDK guarda no cache local, só da configuração: sem banco, sem
        comprovante.


        **Autenticação.** Qualquer chave de fonte, sejam quais forem os escopos:
        `Authorization: Bearer nia_sk_...`.
      operationId: sdk_profile_v1_sdk_profile_get
      parameters:
        - in: header
          name: if-none-match
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: If-None-Match
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SdkProfile'
          description: Resposta de sucesso.
        '304':
          description: O perfil atrás de `If-None-Match` continua atual.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            # Read once at start and again when valid_for_s runs out; the last
            profile stays in use when Niadra is down

            profile = niadra.profile()

            if profile and "turns" in profile.features:
                ...
        - lang: typescript
          label: TypeScript
          source: >-
            // Read once at start and again when valid_for_s runs out; the last
            profile stays in use when Niadra is down

            const profile = await niadra.profile();

            if (profile?.features.includes("turns")) {
              // ...
            }
components:
  schemas:
    SdkProfile:
      additionalProperties: false
      description: >-
        O que o SDK guarda no cache local: as funcionalidades ligadas, as
        vinculações de ferramenta da fonte, o registro de tipos resumido, o
        contrato de afirmação e a gravação de turnos.
      properties:
        claim_contract:
          anyOf:
            - $ref: '#/components/schemas/ClaimContractSummary'
            - type: 'null'
        features:
          items:
            $ref: '#/components/schemas/Feature'
          title: Features
          type: array
        recording:
          anyOf:
            - $ref: '#/components/schemas/TurnRecordingSummary'
            - type: 'null'
          description: Como esta fonte grava turnos, quando o espaço os grava.
        tool_bindings:
          description: As vinculações das ferramentas que os agentes desta fonte chamam.
          items:
            $ref: '#/components/schemas/ToolBinding'
          title: Tool Bindings
          type: array
        types:
          items:
            additionalProperties: true
            type: object
          title: Types
          type: array
        valid_for_s:
          title: Valid For S
          type: integer
      required:
        - features
        - valid_for_s
      title: SdkProfile
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    ClaimContractSummary:
      additionalProperties: false
      description: >-
        O contrato como o SDK o guarda: tudo menos as frases do corpus negativo,
        que só o `niadra contract test` do CI lê, da cópia da própria empresa.
      properties:
        categories:
          items:
            $ref: '#/components/schemas/ClaimCategory'
          title: Categories
          type: array
        internal_text:
          anyOf:
            - $ref: '#/components/schemas/InternalText'
            - type: 'null'
        languages:
          items:
            enum:
              - pt
              - en
              - es
            type: string
          title: Languages
          type: array
        negative_corpus_version:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Negative Corpus Version
        outputs:
          $ref: '#/components/schemas/ClaimOutputs'
        version:
          maxLength: 256
          minLength: 1
          title: Version
          type: string
      required:
        - version
        - languages
      title: ClaimContractSummary
      type: object
    Feature:
      description: >-
        As funcionalidades de agente que um espaço liga: tudo fica desligado até
        o documento `features` do espaço listar a funcionalidade, e `GET
        /v1/sdk/profile` anuncia o que está ligado.
      enum:
        - turns
        - state
        - agent_state
        - signals
        - claims
        - coordination
        - measurement
        - notifications
        - legal_holds
      title: Feature
      type: string
    TurnRecordingSummary:
      additionalProperties: false
      description: >-
        Como a fonte que chama grava turnos, para a captura do SDK: onde os
        valores podem morar e os pinos de que um turno precisa para ser
        reproduzível.
      properties:
        content_mode:
          description: >-
            `stored`, `pointer` ou `hash_only`; um turno pode guardar menos,
            nunca mais.
          enum:
            - stored
            - pointer
            - hash_only
          title: Content Mode
          type: string
        required_pins:
          description: Sem um destes, um turno é guardado como não reproduzível.
          items:
            enum:
              - prompts
              - corpus_digest
              - model
              - assembler
              - tool_schemas
            type: string
          title: Required Pins
          type: array
      required:
        - content_mode
        - required_pins
      title: TurnRecordingSummary
      type: object
    ToolBinding:
      additionalProperties: false
      properties:
        args:
          items:
            $ref: '#/components/schemas/BoundArg'
          maxItems: 50
          title: Args
          type: array
        capabilities:
          $ref: '#/components/schemas/ToolCapabilities'
        results:
          items:
            $ref: '#/components/schemas/ResultObjects'
          maxItems: 10
          title: Results
          type: array
        tool:
          pattern: ^[A-Za-z0-9_][A-Za-z0-9_.:/-]{0,63}$
          title: Tool
          type: string
      required:
        - tool
      title: ToolBinding
      type: object
    ClaimCategory:
      additionalProperties: false
      properties:
        actions:
          $ref: '#/components/schemas/Actions'
        agents:
          description: 'Vazio: todos os agentes.'
          items:
            maxLength: 256
            minLength: 1
            type: string
          maxItems: 50
          title: Agents
          type: array
        detect:
          $ref: '#/components/schemas/Detect'
        evidence:
          $ref: '#/components/schemas/ClaimEvidence'
        id:
          pattern: ^[a-z][a-z0-9_]{0,39}$
          title: Id
          type: string
        natures:
          $ref: '#/components/schemas/Natures'
      required:
        - id
        - detect
        - evidence
        - actions
      title: ClaimCategory
      type: object
    InternalText:
      additionalProperties: false
      description: >-
        Impressões digitais do prompt da própria empresa: hashes de cada `n`
        palavras, calculados pelo SDK, nunca o prompt. Uma saída que repete uma
        delas dá lugar a `redact`, registrado como afirmação da categoria
        `internal_text` com o veredito `internal_text_found`, a ação tomada e,
        como evidência, o `shingle_hashes_ref` em `document`.
      properties:
        'n':
          default: 8
          maximum: 32
          minimum: 4
          title: 'N'
          type: integer
        redact:
          maxLength: 200
          minLength: 1
          title: Redact
          type: string
        shingle_hashes_ref:
          description: A versão do prompt de que os hashes foram calculados.
          maxLength: 256
          minLength: 1
          title: Shingle Hashes Ref
          type: string
      required:
        - shingle_hashes_ref
        - redact
      title: InternalText
      type: object
    ClaimOutputs:
      additionalProperties: false
      properties:
        immutable:
          items:
            pattern: ^[a-z][a-z0-9_]{0,39}$
            type: string
          maxItems: 32
          title: Immutable
          type: array
        mutable:
          items:
            pattern: ^[a-z][a-z0-9_]{0,39}$
            type: string
          maxItems: 32
          title: Mutable
          type: array
      title: ClaimOutputs
      type: object
    BoundArg:
      additionalProperties: false
      description: >-
        Um argumento da ferramenta e o campo que ele leva. `in` e `eq` vão para
        `param`, `not_in` e `ne` para o parâmetro da negação, e uma comparação
        ou `between` só quando `ops` a lista.
      properties:
        attr:
          description: O campo, como `tipo.campo`.
          pattern: ^[a-z][a-z0-9_]{0,39}\.[a-z][a-z0-9_]{0,63}$
          title: Attr
          type: string
        negation:
          anyOf:
            - $ref: '#/components/schemas/Negation'
            - type: 'null'
        ops:
          items:
            enum:
              - in
              - not_in
              - eq
              - ne
              - lt
              - lte
              - gt
              - gte
              - between
            type: string
          maxItems: 9
          title: Ops
          type: array
        param:
          pattern: ^[A-Za-z_][A-Za-z0-9_.-]{0,63}$
          title: Param
          type: string
        transform:
          anyOf:
            - enum:
                - lower
                - upper
              type: string
            - type: 'null'
          description: A caixa em que o texto é enviado.
          title: Transform
      required:
        - attr
        - param
      title: BoundArg
      type: object
    ToolCapabilities:
      additionalProperties: false
      properties:
        dry_run_param:
          anyOf:
            - pattern: ^[A-Za-z_][A-Za-z0-9_.-]{0,63}$
              type: string
            - type: 'null'
          description: >-
            O argumento que faz uma chamada não mudar nada, para um
            contrafactual.
          title: Dry Run Param
        mask_output:
          default: false
          description: >-
            O SDK mascara na saída da ferramenta os campos que a chave não pode
            ler.
          title: Mask Output
          type: boolean
        overfetch:
          default: false
          description: >-
            A ferramenta devolve mais do que pediram: o SDK filtra o residual
            dela.
          title: Overfetch
          type: boolean
        relax_flag:
          anyOf:
            - maxLength: 256
              pattern: ^\$?(\.?[A-Za-z_][A-Za-z0-9_-]*(\[\*\])?)*$
              type: string
            - type: 'null'
          description: Onde o resultado diz que a ferramenta relaxou o que lhe pediram.
          title: Relax Flag
      title: ToolCapabilities
      type: object
    ResultObjects:
      additionalProperties: false
      description: >-
        Onde um resultado traz objetos de um tipo, e que chave de cada item
        guarda que campo.
      properties:
        fields:
          maxProperties: 100
          patternProperties:
            ^[a-z][a-z0-9_]{0,63}$:
              pattern: ^[A-Za-z_][A-Za-z0-9_-]{0,63}$
              type: string
          title: Fields
          type: object
        id:
          default: id
          description: A chave do item que guarda o id do objeto.
          pattern: ^[A-Za-z_][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        namespace:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$
          title: Namespace
          type: string
        path:
          default: $
          maxLength: 256
          pattern: ^\$?(\.?[A-Za-z_][A-Za-z0-9_-]*(\[\*\])?)*$
          title: Path
          type: string
        type:
          pattern: ^[a-z][a-z0-9_]{0,39}$
          title: Type
          type: string
      required:
        - type
        - namespace
      title: ResultObjects
      type: object
    Actions:
      additionalProperties: false
      description: >-
        O que acontece com uma afirmação que não se sustenta, pelo contexto da
        tarefa (um tipo de saída ou de documento); `default` para os demais. Um
        contexto que o contrato lista como imutável nunca é reescrito.
      properties:
        contexts:
          maxProperties: 32
          patternProperties:
            ^[a-z][a-z0-9_]{0,39}$:
              enum:
                - block
                - warn
                - count
                - rewrite_if_unequivocal
                - discard_anchor_and_count
              type: string
          title: Contexts
          type: object
        default:
          enum:
            - block
            - warn
            - count
            - rewrite_if_unequivocal
            - discard_anchor_and_count
          title: Default
          type: string
        replace_with:
          anyOf:
            - maxLength: 500
              minLength: 1
              type: string
            - type: 'null'
          description: >-
            A ressalva que toma o lugar de um trecho bloqueado, numa saída
            mutável.
          title: Replace With
      required:
        - default
      title: Actions
      type: object
    Detect:
      additionalProperties: false
      description: >-
        Como uma categoria acha as afirmações no texto, sem modelo: números
        destas classes, as palavras em volta que dão o papel deles, termos do
        ofício, padrões nomeados ou seções de um documento.
      properties:
        classes:
          items:
            enum:
              - money
              - percent
              - date
              - duration
              - quantity
              - count
              - dosage
            type: string
          maxItems: 7
          title: Classes
          type: array
        document_sections:
          items:
            pattern: ^[a-z][a-z0-9_]{0,39}$
            type: string
          maxItems: 20
          title: Document Sections
          type: array
        patterns:
          items:
            enum:
              - article_citation
              - precedent_citation
            type: string
          title: Patterns
          type: array
        roles:
          description: >-
            As palavras que dão a um número o papel dele, com sinônimos e todos
            os idiomas numa lista só.
          maxProperties: 32
          patternProperties:
            ^[a-z][a-z0-9_]{0,39}$:
              items:
                maxLength: 80
                minLength: 1
                type: string
              type: array
          title: Roles
          type: object
        terms:
          description: >-
            Com `classes`, um número só conta numa frase que traz um dos termos;
            sozinho, o termo é a afirmação.
          items:
            maxLength: 80
            minLength: 1
            type: string
          maxItems: 100
          title: Terms
          type: array
      title: Detect
      type: object
    ClaimEvidence:
      additionalProperties: false
      description: >-
        O que o registro do turno precisa ter para uma afirmação da categoria se
        sustentar: exatamente um tipo.
      properties:
        anchor:
          anyOf:
            - $ref: '#/components/schemas/AnchorEvidence'
            - type: 'null'
        tool:
          anyOf:
            - pattern: ^[A-Za-z][A-Za-z0-9_.:-]{0,63}$
              type: string
            - type: 'null'
          description: Uma chamada desta ferramenta no turno.
          title: Tool
        tool_any:
          items:
            pattern: ^[A-Za-z][A-Za-z0-9_.:-]{0,63}$
            type: string
          maxItems: 20
          title: Tool Any
          type: array
        value:
          anyOf:
            - $ref: '#/components/schemas/ValueEvidence'
            - type: 'null'
      title: ClaimEvidence
      type: object
    Natures:
      additionalProperties: false
      description: >-
        Como um número é tratado conforme de onde veio: computado (um valor com
        proveniência no turno, por regra ou observado) é conferido contra ela;
        citado (entre aspas) é conferido só por estar numa fonte, como foi
        escrito, mesmo falso; dito pelo modelo (sem origem) toma esta ação, ou a
        da categoria.
      properties:
        computed:
          default: check
          enum:
            - check
            - count
          title: Computed
          type: string
        model:
          anyOf:
            - enum:
                - block
                - warn
                - count
              type: string
            - type: 'null'
          title: Model
        quoted:
          default: verbatim
          enum:
            - verbatim
            - count
          title: Quoted
          type: string
      title: Natures
      type: object
    Negation:
      additionalProperties: false
      properties:
        param:
          description: O argumento que recebe os valores que o campo não pode ter.
          pattern: ^[A-Za-z_][A-Za-z0-9_.-]{0,63}$
          title: Param
          type: string
      required:
        - param
      title: Negation
      type: object
    AnchorEvidence:
      additionalProperties: false
      properties:
        coverage:
          description: 'Contadas à parte: lei e fato nunca se somam.'
          enum:
            - fact
            - law
          title: Coverage
          type: string
        min_match:
          default: 0.9
          maximum: 1
          minimum: 0.9
          title: Min Match
          type: number
      required:
        - coverage
      title: AnchorEvidence
      type: object
    ValueEvidence:
      additionalProperties: false
      description: >-
        Um valor no registro do turno, do resultado de uma ferramenta ou do
        estado, contra o qual o número é conferido.
      properties:
        fresh_for:
          anyOf:
            - const: claim
              type: string
            - type: 'null'
          description: >-
            O valor está dentro do `claim_max_age` do tipo dele, ou a afirmação
            é `stale`.
          title: Fresh For
        gap_terms:
          description: >-
            As palavras que declaram cada lacuna; uma lacuna sem elas é dita
            pelo nome.
          maxProperties: 32
          patternProperties:
            ^[a-z][a-z0-9_]{0,39}$:
              items:
                maxLength: 80
                minLength: 1
                type: string
              type: array
          title: Gap Terms
          type: object
        must_state_gaps:
          default: false
          description: >-
            As lacunas declaradas do valor precisam ser ditas com ele, ou
            `gap_not_stated`.
          title: Must State Gaps
          type: boolean
        same_role:
          default: false
          description: O papel do valor é o papel do número.
          title: Same Role
          type: boolean
        type:
          anyOf:
            - pattern: ^[a-z][a-z0-9_]{0,39}$
              type: string
            - type: 'null'
          title: Type
        value:
          anyOf:
            - pattern: ^[a-z][a-z0-9_]{0,39}$
              type: string
            - type: 'null'
          description: Um campo ou um valor computado de `type`.
          title: Value
      title: ValueEvidence
      type: object

````