> ## 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.ContextExpression

<h2 id="autogen.ContextExpression" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

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

```python theme={null}
ContextExpression(expression: str)
```

A class to evaluate logical expressions using context variables.<br />

<b>Parameters:</b>

| Name         | Description   |
| ------------ | ------------- |
| `expression` | **Type:** str |

### Instance Attributes

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

#### expression

<br />

<br />

### Instance Methods

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

#### evaluate

```python theme={null}
evaluate(self, context_variables: ContextVariables) -> bool
```

Evaluate the expression using the provided context variables.<br />

<b>Parameters:</b>

| Name                | Description                                                                                                                                                                   |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `context_variables` | Dictionary of context variables to use for evaluation<br /><br />**Type:** [ContextVariables](/docs/api-reference/autogen/agentchat/group/context_variables/ContextVariables) |

<b>Returns:</b>

| Type | Description                                   |
| ---- | --------------------------------------------- |
| bool | bool: The result of evaluating the expression |

<br />
