File size: 2,919 Bytes
18dc680
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Binary Agent

**Type:** `binary`  
**Category:** Simple Decision Agent  
**Version:** v0.9.4+

## Overview

The Binary Agent performs simple, rule-based true/false decisions without LLM inference. It's fast, free, and suitable for pattern matching and basic conditional logic.

**Note:** For complex reasoning, use [`openai-binary`](./openai-binary.md) instead.

## Basic Configuration

```yaml
- id: has_email
  type: binary
  prompt: "Contains email? {{ input }}"
```

## Parameters

### Required Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `id` | string | Unique identifier |
| `type` | string | Must be `binary` |
| `prompt` | string | Question to evaluate |

### Optional Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `timeout` | float | `10.0` | Processing timeout |
| `queue` | string | `orka:main` | Processing queue |

## Output Format

Returns a string: `"true"` or `"false"`

```python
{
    "response": "true"  # or "false"
}
```

## Usage Examples

### Example 1: Pattern Matching

```yaml
- id: contains_keyword
  type: binary
  prompt: "Contains 'urgent'? {{ input }}"

- id: has_url
  type: binary
  prompt: "Contains http:// or https://? {{ input }}"

- id: is_question
  type: binary
  prompt: "Ends with question mark? {{ input }}"
```

### Example 2: Simple Routing

```yaml
- id: is_empty
  type: binary
  prompt: "Is input empty? {{ input }}"

- id: router
  type: router
  params:
    decision_key: is_empty
    routing_map:
      "true": [handle_empty]
      "false": [process_input]
```

### Example 3: Length Check

```yaml
- id: is_long
  type: binary
  prompt: "Is length > 1000 characters? {{ input }}"
```

## When to Use Binary vs OpenAI-Binary

| Use Case | Use `binary` | Use `openai-binary` |
|----------|--------------|---------------------|
| Pattern matching | βœ… | ❌ |
| Keyword detection | βœ… | ❌ |
| Length checks | βœ… | ❌ |
| Format validation | βœ… | ❌ |
| Complex reasoning | ❌ | βœ… |
| Context understanding | ❌ | βœ… |
| Nuanced decisions | ❌ | βœ… |
| Quality assessment | ❌ | βœ… |

## Best Practices

```yaml
# βœ… GOOD: Simple, objective checks
- id: has_data
  type: binary
  prompt: "Has data? {{ previous_outputs.search }}"

# ❌ BAD: Complex reasoning (use openai-binary instead)
- id: is_appropriate
  type: binary
  prompt: "Is this content appropriate for children? {{ input }}"
```

## Performance

- **Speed:** Instant (no API calls)
- **Cost:** Free
- **Reliability:** 100% deterministic

## Limitations

- No context understanding
- No semantic reasoning
- Simple pattern matching only
- Limited to basic conditionals

## Related Documentation

- [OpenAI Binary Agent](./openai-binary.md) - For complex decisions
- [Router Node](../nodes/router.md)

## Version History

- **v0.9.4**: Current stable version
- **v0.1.0**: Initial release