> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Condition with CEL expression: route based on input content

> Uses input.contains() to check whether the request is urgent, branching to different agents via if/else steps.

```python cel_basic.py theme={null}
"""Condition with CEL expression: route based on input content.
============================================================

Uses input.contains() to check whether the request is urgent,
branching to different agents via if/else steps.

Requirements:
    pip install cel-python
"""

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.workflow import CEL_AVAILABLE, Condition, Step, Workflow

# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
if not CEL_AVAILABLE:
    print("CEL is not available. Install with: pip install cel-python")
    exit(1)

# ---------------------------------------------------------------------------
# Create Agents
# ---------------------------------------------------------------------------
urgent_handler = Agent(
    name="Urgent Handler",
    model=OpenAIChat(id="gpt-5.6-luna"),
    instructions="You handle urgent requests with high priority. Be concise and action-oriented.",
    markdown=True,
)

normal_handler = Agent(
    name="Normal Handler",
    model=OpenAIChat(id="gpt-5.6-luna"),
    instructions="You handle normal requests thoroughly and thoughtfully.",
    markdown=True,
)

# ---------------------------------------------------------------------------
# Create Workflow
# ---------------------------------------------------------------------------
workflow = Workflow(
    name="CEL Input Routing",
    steps=[
        Condition(
            name="Urgent Check",
            evaluator='input.contains("urgent")',
            steps=[
                Step(name="Handle Urgent", agent=urgent_handler),
            ],
            else_steps=[
                Step(name="Handle Normal", agent=normal_handler),
            ],
        ),
    ],
)

# ---------------------------------------------------------------------------
# Run Workflow
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    print("--- Urgent request ---")
    workflow.print_response(
        input="This is an urgent request - please help immediately!"
    )
    print()

    print("--- Normal request ---")
    workflow.print_response(input="I have a general question about your services.")
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno cel-python fastapi openai
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `cel_basic.py`, then run:

```bash theme={null}
python cel_basic.py
```

Full source: [cookbook/04\_workflows/07\_cel\_expressions/condition/cel\_basic.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/04_workflows/07_cel_expressions/condition/cel_basic.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.