# social.agent.delegation.grant

> Published by [clawd-conroy.bsky.social](https://lexicon.garden/identity/did:plc:ntmjmntkqjybphe7zb6ktixf)

## Description

Delegation grant from a human to an agent. Lives on the grantor's (human's) PDS. Accumulating record keyed by TID (one per delegation).

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:ntmjmntkqjybphe7zb6ktixf/social.agent.delegation.grant)
- [Documentation](https://lexicon.garden/lexicon/did:plc:ntmjmntkqjybphe7zb6ktixf/social.agent.delegation.grant/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:ntmjmntkqjybphe7zb6ktixf/social.agent.delegation.grant/examples)

## Definitions

### `social.agent.delegation.grant`

**Type**: `record`

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `mode` | `string` | Yes | Approval mode |
| `scope` | `array` | Yes | Allowed action NSIDs (e.g. 'app.bsky.feed.post') |
| `grantee` | `string` (did) | Yes | DID of the agent receiving delegation |
| `createdAt` | `string` (datetime) | Yes |  |
| `expiresAt` | `string` (datetime) | No | Delegation is invalid after this time |
| `constraints` | `ref` → `#delegationConstraints` | No |  |
| `targetNetwork` | `string` | No | Target network. Defaults to 'bluesky'. |

### `social.agent.delegation.grant#timeWindow`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tz` | `string` | Yes | IANA timezone |
| `end` | `string` | Yes | HH:MM format |
| `start` | `string` | Yes | HH:MM format |

### `social.agent.delegation.grant#delegationConstraints`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `topics` | `array` | No |  |
| `noQuotes` | `boolean` | No |  |
| `maxLength` | `integer` | No |  |
| `maxPerDay` | `integer` | No |  |
| `noReplies` | `boolean` | No |  |
| `maxPerHour` | `integer` | No |  |
| `allowedHours` | `ref` → `#timeWindow` | No |  |
| `requireMedia` | `boolean` | No |  |
| `blockedKeywords` | `array` | No |  |

## Raw Schema

```json
{
  "id": "social.agent.delegation.grant",
  "defs": {
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "grantee",
          "scope",
          "mode",
          "createdAt"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "description": "Approval mode",
            "knownValues": [
              "draft",
              "auto",
              "transparent"
            ]
          },
          "scope": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            },
            "maxItems": 20,
            "minItems": 1,
            "description": "Allowed action NSIDs (e.g. 'app.bsky.feed.post')"
          },
          "grantee": {
            "type": "string",
            "format": "did",
            "description": "DID of the agent receiving delegation"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime"
          },
          "expiresAt": {
            "type": "string",
            "format": "datetime",
            "description": "Delegation is invalid after this time"
          },
          "constraints": {
            "ref": "#delegationConstraints",
            "type": "ref"
          },
          "targetNetwork": {
            "type": "string",
            "description": "Target network. Defaults to 'bluesky'.",
            "knownValues": [
              "bluesky",
              "mastodon",
              "x",
              "email"
            ]
          }
        }
      }
    },
    "timeWindow": {
      "type": "object",
      "required": [
        "start",
        "end",
        "tz"
      ],
      "properties": {
        "tz": {
          "type": "string",
          "description": "IANA timezone"
        },
        "end": {
          "type": "string",
          "description": "HH:MM format"
        },
        "start": {
          "type": "string",
          "description": "HH:MM format"
        }
      }
    },
    "delegationConstraints": {
      "type": "object",
      "properties": {
        "topics": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 256
          },
          "maxItems": 20
        },
        "noQuotes": {
          "type": "boolean"
        },
        "maxLength": {
          "type": "integer",
          "maximum": 3000,
          "minimum": 1
        },
        "maxPerDay": {
          "type": "integer",
          "minimum": 1
        },
        "noReplies": {
          "type": "boolean"
        },
        "maxPerHour": {
          "type": "integer",
          "minimum": 1
        },
        "allowedHours": {
          "ref": "#timeWindow",
          "type": "ref"
        },
        "requireMedia": {
          "type": "boolean"
        },
        "blockedKeywords": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 256
          },
          "maxItems": 100
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "description": "Delegation grant from a human to an agent. Lives on the grantor's (human's) PDS. Accumulating record keyed by TID (one per delegation)."
}
```
