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

# WorkGraph Example

> A realistic multi-step workflow using dependencies, claims, evidence, and readiness.

# WorkGraph Example

This example models a Homecore-style situation where incoming information,
calendar context, and routine automation produce shared durable work.

## Scenario

A calendar event says L is taking A to the dentist on May 20. A strongly
prefers car P. A new maintenance update says car P is in the workshop. A needs
preparation for irregularities, so L should receive a reminder the day before
the appointment.

WorkGraph does not infer the family policy. The agent reasons about the data,
then records the durable commitment and dependencies.

## 1. Create The Work Items

```json theme={null}
{
  "tool": "workgraph_create",
  "arguments": {
    "namespace": "homecore",
    "title": "Verify dentist transport details",
    "description": "Confirm appointment time, driver, preferred car status, and replacement car.",
    "priority": "high",
    "labels": ["family-logistics", "transport"],
    "external_refs": [
      { "kind": "calendar_event", "id": "dentist-a-2026-05-20" },
      { "kind": "maintenance_record", "id": "car-p-workshop-2026-05-18" }
    ]
  }
}
```

```json theme={null}
{
  "tool": "workgraph_create",
  "arguments": {
    "namespace": "homecore",
    "title": "Prepare L reminder for dentist transport change",
    "description": "Tell L to explain to A that car P is unavailable and name the replacement car.",
    "priority": "high",
    "labels": ["family-logistics", "autism-support"],
    "due_at": "2026-05-19T08:00:00Z",
    "external_refs": [
      { "kind": "calendar_event", "id": "dentist-a-2026-05-20" }
    ]
  }
}
```

## 2. Link The Dependency

```json theme={null}
{
  "tool": "workgraph_link",
  "arguments": {
    "namespace": "homecore",
    "kind": "blocks",
    "from_id": "work_verify_transport",
    "to_id": "work_prepare_l_reminder"
  }
}
```

The reminder item should not be ready until transport details are verified.

## 3. Ask WorkGraph What Is Ready

```json theme={null}
{
  "tool": "workgraph_ready",
  "arguments": {
    "namespace": "homecore",
    "labels": ["family-logistics"],
    "limit": 10
  }
}
```

The agent does not inspect blocker counts itself. It works from the ready list
returned by WorkGraph.

## 4. Claim, Act, And Add Evidence

```json theme={null}
{
  "tool": "workgraph_claim",
  "arguments": {
    "namespace": "homecore",
    "id": "work_verify_transport",
    "expected_revision": 1,
    "owner": {
      "key": { "kind": "agent", "id": "homecore/logistics" },
      "display_name": "Homecore logistics"
    },
    "lease_seconds": 1200
  }
}
```

After checking the maintenance and vehicle data, the agent attaches evidence.

```json theme={null}
{
  "tool": "workgraph_add_evidence",
  "arguments": {
    "namespace": "homecore",
    "id": "work_verify_transport",
    "expected_revision": 2,
    "evidence": {
      "kind": "summary",
      "id": "transport-check-2026-05-18",
      "label": "Transport verified",
      "summary": "Car P is in workshop; replacement car is car Q."
    }
  }
}
```

Then it closes the blocker.

```json theme={null}
{
  "tool": "workgraph_close",
  "arguments": {
    "namespace": "homecore",
    "id": "work_verify_transport",
    "expected_revision": 3,
    "status": "completed"
  }
}
```

The dependent reminder can now become ready when its time gates allow it.

## 5. Observe The Graph

A UI or operator can inspect the same realm without mutating it:

```bash theme={null}
rkat --realm home workgraph snapshot --namespace homecore --json
```

or:

```bash theme={null}
curl "http://127.0.0.1:8080/workgraph/snapshot?namespace=homecore"
```

## Why This Is Not An Expert System

The LLM decides what matters from calendar data, maintenance records, family
preferences, and user policy. WorkGraph only records the durable to-do spine:
dependencies, readiness, claim state, evidence, and terminal truth.
