---
node_type: semaphore_release
category: control
---

# Semaphore Release

Explicitly releases a semaphore permit held by the current job. Optional - permits are automatically released on job completion.

## Overview

The Semaphore Release node releases a permit that was acquired by SemaphoreAcquire for the same job. This node is optional since permits are automatically released when the job completes, but can be useful for releasing early.

**Key Features:**
- Releases permit acquired by SemaphoreAcquire for the same job
- Passes through input data unchanged
- Idempotent (safe to call multiple times)

## When to Use

Use Semaphore Release when you need to:
- Release a permit early (before job completes)
- Allow other jobs to proceed while continuing with non-critical work
- Explicitly control the critical section boundary

## Configuration

### Fields

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| key_template | String | Yes | Template for semaphore key. Must match the key used in SemaphoreAcquire. Use {{ field }} syntax for interpolation from input. |

## Inputs

| Socket | Type | Required | Description |
|--------|------|----------|-------------|
| input | Any | Yes | Input data to pass through. Also used for key template interpolation. |

## Outputs

| Socket | Type | Description |
|--------|------|-------------|
| output | Any | Same value as input (passthrough) |

## Example: Early Release

Release semaphore after critical section, continue with logging:

```json
{
  "nodes": [
    {
      "id": "gate",
      "type": "semaphore_acquire",
      "config": {
        "key_template": "telegram/{{ chat.id }}",
        "permits": 1
      },
      "inputs": {
        "input": "{{ trigger }}"
      }
    },
    {
      "id": "process",
      "type": "ai_agent",
      "inputs": {
        "input": "{{ gate.output }}"
      }
    },
    {
      "id": "release",
      "type": "semaphore_release",
      "config": {
        "key_template": "telegram/{{ chat.id }}"
      },
      "inputs": {
        "input": "{{ gate.output }}"
      }
    },
    {
      "id": "log",
      "type": "http_get",
      "inputs": {
        "url": "https://logs.example.com/write"
      }
    }
  ]
}
```

**Execution Flow:**
1. SemaphoreAcquire blocks until permit available
2. Process node runs with exclusive access
3. SemaphoreRelease releases permit (other jobs can now proceed)
4. Log node runs without holding semaphore

## Automatic Release

If you don't use SemaphoreRelease, the permit is automatically released when the job completes. In most cases, you don't need an explicit release node.

## Related Nodes

- [semaphore_acquire](./semaphore_acquire.md) - Acquire a semaphore permit
