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

# autogen.agentchat.group.OnContextCondition

<h2 id="autogen.agentchat.group.OnContextCondition" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">OnContextCondition</span>
</h2>

```python theme={null}
OnContextCondition(**data: Any)
```

Defines a condition for transitioning to another agent or nested chats using context variables and the ContextExpression class.<br />This is for context variable-based condition evaluation (does not use the agent's LLM).<br />These are evaluated before the OnCondition and after work conditions.<br />

<b>Parameters:</b>

| Name     | Description   |
| -------- | ------------- |
| `**data` | **Type:** Any |

### Class Attributes

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### available

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### condition

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### model\_config

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### target

<br />

<br />

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### has\_target\_type

```python theme={null}
has_target_type(self, target_type: type) -> bool
```

Check if the target type matches the specified type.<br />

<b>Parameters:</b>

| Name          | Description                                                                                                      |
| ------------- | ---------------------------------------------------------------------------------------------------------------- |
| `target_type` | The target type to check against.<br /><br />Should be a subclass of TransitionTarget.<br /><br />**Type:** type |

<b>Returns:</b>

| Type | Description                                            |
| ---- | ------------------------------------------------------ |
| bool | bool: True if the target type matches, False otherwise |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### target\_requires\_wrapping

```python theme={null}
target_requires_wrapping(self) -> bool
```

Check if the target requires wrapping in an agent.<br />Returns: <br />    bool: True if the target requires wrapping, False otherwise

<b>Returns:</b>

| Type | Description                                                 |
| ---- | ----------------------------------------------------------- |
| bool | bool: True if the target requires wrapping, False otherwise |

<br />
