> For the complete documentation index, see [llms.txt](https://docs.bardiel.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bardiel.tech/technical-architecture/core-primitives.md).

# Core Primitives

> **Status:** Draft — API shapes and policies may evolve as Bardiel, Corgent, and the Cortensor Router advance.

Bardiel does **not** talk directly to miners.\
Almost everything it does rides on two core primitives exposed by the **Cortensor Router**:

* **`/delegate`** – *execution primitive*\
  “Send this job to the Cortensor network under a specific policy.”
* **`/validate`** – *safety / trust primitive*\
  “Check this result under a specific policy before I act or pay.”

These primitives matter across **Base, Virtual, ERC-8004, and other agent ecosystems**.

They are:

* the **primary surface for Corgent** — Cortensor’s infra-native agent for ERC-8004 and broader agent ecosystems
* the **trust and execution backbone for Bardiel** — the product layer that packages those same primitives for Base-native agents, Virtual GAME / ACP flows, ERC-8004-compatible systems, and other onchain agent markets

This page explains how **Bardiel** conceptually uses `/delegate` and `/validate`.\
For exact schema details, see Bardiel’s **Agent Surfaces** and the Router-level API references.

***

### 1. High-Level Concept

#### 1.1 What `/delegate` Does (Execution Primitive)

`/delegate` is **“send this job to the network”**:

* you describe **what** you want done and **how** it should be run (policy)
* Cortensor routes the task across **miners** according to that policy
* you get back **results plus evidence**, not just a string

Two generations are supported underneath Bardiel:

* **`/delegate` v1**
  * simple prompt → single completion
  * uses legacy fields like `task_request_input` for compatibility
* **`/delegate` v2**
  * lets agents offload **small, bounded workflows** with:
    * tools
    * max-step limits
    * timeouts and policies
  * returns **structured evidence** (steps taken, tools used, configs) so upstream agents can reason about *how* work was performed, not just *what* the answer is

**Mental model for Bardiel:**\
`/delegate` turns Cortensor into Bardiel’s **execution fabric** — Bardiel decides *what* to ask for and *which policy tier* to use; Router and miners handle *how* it gets computed.

This is the core of Bardiel’s **“AWS for agents”** positioning.

***

#### 1.2 What `/validate` Does (Safety / Trust Primitive)

`/validate` is the **checkpoint** Bardiel uses before an agent, app, or market takes an irreversible step:

* Bardiel sends **what was asked**, **what was produced**, and **how it should be judged**
* Cortensor re-runs or cross-checks work on the network where needed
* Bardiel receives a **stable verdict** and supporting evidence that it can turn into its own status codes:
  * `VALID`
  * `INVALID`
  * `RETRY`
  * `NEEDS_SPEC`
  * and, for arbitration flows, seller-oriented dispute verdicts

Two generations are supported underneath Bardiel:

* **`/validate` v1**
  * LLM-style “check this” with free-form output
  * uses `task_request_input` / `task_result_output` plus basic criteria
* **`/validate` v2**
  * standard verdict-oriented contract with structured payloads for:
    * the **claim** being judged
    * the **context** around it
    * the **policy** (tier, redundancy, rules)
  * can run **redundant checks** and aggregate them into a single verdict

**Mental model for Bardiel:**\
`/validate` is Bardiel’s **checkpoint for agency and safety** at the infrastructure level — the neutral trust primitive it uses to power Validation-as-a-Service and, where needed, Arbitration-as-a-Service.

***

#### 1.3 Why These Two Matter for Bardiel and the Agent Economy

Without these primitives underneath Bardiel:

* **Without `/delegate`**\
  Bardiel would have to manage:
  * GPUs and infra directly
  * routing and retries
  * per-market tool orchestration
* **Without `/validate`**\
  There is no shared, neutral checkpoint at the network level to say:\
  “This result is safe enough or correct enough to act or pay on.”

With `/delegate` and `/validate` available at the Router:

* Bardiel can offer **Delegation-as-a-Service** and **Validation-as-a-Service** to Base-native agents, Virtual flows, ERC-8004-compatible markets, and other ecosystems
* Bardiel can focus on **policies, templates, UX, and verdict semantics**, while Cortensor focuses on **compute and proofs**

These are the primitives Bardiel uses for:

* REST-style integrations
* MCP
* x402 pay-per-call flows
* Base-native agent apps
* Virtual GAME / ACP flows
* ERC-8004-compatible registries and markets
* other agent ecosystems that need shared trust and execution rails

v1 remains a simpler, legacy-compatible path.\
v2 is where Bardiel becomes a serious trust and execution layer.

***

### 2. Endpoint Matrix (Router / Bardiel Perspective)

Bardiel itself exposes **agent-friendly surfaces** for apps, agents, and markets, but under the hood it calls the Cortensor Router.

At the Router level, endpoints are exposed with:

* **v1 vs v2** payloads
* **normal**, **trial**, and **x402** variants

For Bardiel’s internal usage, the Router matrix looks like:

#### 2.1 REST Endpoint Matrix (Router-Level)

| Flow        | Normal             | Trial                    | x402                    |
| ----------- | ------------------ | ------------------------ | ----------------------- |
| Delegate v1 | `/api/v1/delegate` | `/api/v1/trial/delegate` | `/api/v1/x402/delegate` |
| Validate v1 | `/api/v1/validate` | `/api/v1/trial/validate` | `/api/v1/x402/validate` |
| Delegate v2 | `/api/v2/delegate` | `/api/v2/trial/delegate` | `/api/v2/x402/delegate` |
| Validate v2 | `/api/v2/validate` | `/api/v2/trial/validate` | `/api/v2/x402/validate` |

#### 2.2 Usage Modes (from Bardiel’s Point of View)

* **Normal**\
  Standard authenticated calls Bardiel uses for steady-state workloads.
* **Trial**\
  Rate-limited evaluation path, useful for Bardiel’s own test flows, demos, onboarding, or alpha testers.
* **x402**\
  Payment-gated variant used when Bardiel is operating in a **pay-per-call** mode:
  * first call returns HTTP 402 with payment terms
  * a payment is made
  * Bardiel retries with a payment proof header

Bardiel’s **Sessions, Billing & x402** page explains how these Router-level modes map into Bardiel’s own session and funding logic.

***

### 3. Payload Shapes – v1 vs v2 (Conceptual)

Bardiel’s **Agent Surfaces** wrap these payloads into an agent-facing envelope (`mode`, `task`, `policy`, `context`).\
This section shows the **Router-level shapes** Bardiel builds internally.

#### 3.1 `/delegate` v1 – Prompt-Oriented

Use when:

* Bardiel needs a **simple completion** from Cortensor
* backward compatibility or low-complexity tasks are sufficient

Conceptual example (Router POST `/api/v1/delegate`):

```
{
  "session_id": 110,
  "task_request_input": "Create incident communication draft for MCP downtime.",
  "task_domain": "ops",
  "task_type": "communication",
  "evaluation_mode": "high_reliability",
  "web_url": "https://status.example.com"
}
```

Key fields:

* `session_id` – Cortensor session to use (funding + routing config)
* `task_request_input` – main prompt Bardiel sends
* optional domain/type hints (`task_domain`, `task_type`)
* optional evaluation mode and URL context

Bardiel uses this format mainly for **simple delegation flows** and compatibility with older Router deployments.

***

#### 3.2 `/delegate` v2 – Workflow-Oriented

Use when:

* Bardiel is offloading **structured workflows**, not just single prompts
* tools, multi-step control, and explicit policies are needed

Conceptual example (Router POST `/api/v2/delegate`):

```
{
  "session_id": 205,
  "objective": "Use tools to evaluate candidate responses and choose the best one.",
  "input": {
    "kind": "array",
    "items": ["response A", "response B", "response C"]
  },
  "execution": {
    "mode": "tools",
    "model": "auto",
    "tools": ["rank_candidates", "summarize_text"],
    "max_steps": 8
  },
  "policy": {
    "tier": "balanced",
    "timeout_ms": 30000
  }
}
```

Key fields:

* `objective` – short, plain-language description of the task
* `input` – structured input (string, array, object, etc.)
* `execution` – how the network should run it:
  * `mode` (for example `tools`, `simple`, `chain`)
  * `model` (or `auto`)
  * `tools`, `max_steps`, etc.
* `policy` – trust / SLA profile:
  * tier, timeout, and possible redundancy knobs (by Router version)

Bardiel wraps this inside its **delegation** mode when it needs workflows with tooling.

***

#### 3.3 `/validate` v1 – Prompt-Oriented Check

Use when:

* Bardiel wants LLM-style “is this OK?” checks with minimal structure
* outputs are text-like and acceptance rules are simple

Conceptual example (Router POST `/api/v1/validate`):

```
{
  "session_id": 302,
  "task_request_input": "Provide three bullet points about x402 payment flow.",
  "task_result_output": "x402 returns 402, client pays, then retries with receipt.",
  "task_domain": "api",
  "task_type": "explanation",
  "acceptance_criteria": ["accuracy", "conciseness", "non_hallucination"],
  "evaluation_mode": "llm_judge"
}
```

Key fields:

* `task_request_input` – original request
* `task_result_output` – output Bardiel wants checked
* `acceptance_criteria` – free-form acceptance rules
* `evaluation_mode` – how Router/validators should judge it

Bardiel can map the Router’s response into its own `VALID` / `INVALID` / `RETRY` style statuses.

***

#### 3.4 `/validate` v2 – Verdict-Oriented Check

Use when:

* Bardiel needs a **clear verdict contract** for high-impact decisions
* workloads may trigger payments, settlements, or onchain outcomes

Conceptual example (Router POST `/api/v2/validate`):

```
{
  "session_id": 409,
  "request_id": "v2-val-009",
  "claim": {
    "type": "summary",
    "description": "Summarize MCP endpoints exposed by router.",
    "output": "Stream endpoint is /mcp/messages and legacy is /messages.",
    "input_hash": "0xabc123"
  },
  "policy": {
    "tier": "balanced",
    "redundancy": 1,
    "rules": ["consistency", "non-hallucination"]
  },
  "context": {
    "dapp": "mcp-docs"
  }
}
```

Typical Router-level response (conceptual):

```
{
  "verdict": "VALID",
  "confidence": 0.92,
  "reasons": ["matches spec", "internally consistent"],
  "evidence": {
    "runs": [],
    "scores": []
  }
}
```

Bardiel then translates:

* `verdict` → Bardiel `status`
* `confidence` → Bardiel `confidence`
* `evidence` → Bardiel `evidence`

as described in **Agent Surfaces** and **Validation Templates & Modes**.

***

### 4. How Bardiel Uses `/delegate` and `/validate`

From the caller’s perspective, Bardiel exposes:

* `mode`: `delegation`, `validation`, `arbitration`
* `policy`: `fast`, `safe`, `oracle`, `adaptive`
* a **task envelope** (task type, input, spec, claimed result, dispute context)

Internally, Bardiel:

1. **Reads intent**\
   Understands whether the call is delegation, validation, or arbitration.
2. **Chooses policy tier**\
   Maps `fast`, `safe`, `oracle`, and `adaptive` into Router-level tiers and redundancy.
3. **Builds Router requests**\
   Chooses between:
   * `/delegate` v1 or v2
   * `/validate` v1 or v2
   * normal vs trial vs x402
4. **Interprets Router results**\
   Uses PoI / PoUW-style signals and template logic to convert Router responses into:
   * `VALID`, `INVALID`, `RETRY`, `NEEDS_SPEC`
   * `SELLER_VALID`, `SELLER_INVALID`, `INCONCLUSIVE`
   * with `confidence`, `evidence`, and `retry_instructions`
5. **Returns a clean Bardiel response**\
   Back to agents, apps, and markets via Bardiel’s unified **Agent Surfaces** envelope.

***

### 5. Corgent, Bardiel, and the “AWS for Agents” Analogy

At the Router level, Cortensor is aiming to be **AWS for agents**:

* `/delegate` → execution fabric
* `/validate` → trust and safety fabric

Within that:

* **Corgent** is the *infra-facing, ecosystem-neutral* agent surface:
  * leans directly on Router’s REST and MCP surfaces
  * exposes `/delegate` and `/validate` to agent ecosystems and protocols
* **Bardiel** is the *trust and execution product layer*:
  * packages the same router primitives into a cleaner surface for Base, Virtual, ERC-8004, and other ecosystems
  * adds:
    * policies
    * validation templates
    * arbitration logic
    * ecosystem-facing UX and workflows

From a builder’s perspective:

* you integrate with **Bardiel**
* Bardiel integrates with **Router `/delegate` and `/validate`** for you

***

### 6. Where This Page Fits in the Bardiel Docs

Suggested placement in the Bardiel documentation:

* **Section:**\
  `Technical Architecture → Core Primitives`
* **Cross-links:**
  * link **from**:
    * `Technical Architecture` overview
    * `Agent Surfaces`
    * `Validation Templates & Modes`
    * `Arbitration-as-a-Service`
  * link **to**:
    * Cortensor Router API references
    * Corgent docs for lower-level infra details

This page should be treated as the **conceptual bridge** that explains how Bardiel’s delegation, validation, and arbitration surfaces are powered underneath by Cortensor Router’s `/delegate` and \`/validate


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bardiel.tech/technical-architecture/core-primitives.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
