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

# Sanitize Agent Name For Autogen V4 • AI Agents Framework

> sanitize_agent_name_for_autogen_v4: Sanitize agent name to be a valid Python identifier for AutoGen v0.4.

# sanitize\_agent\_name\_for\_autogen\_v4

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**agents\_generator**](../modules/agents_generator) module.

Sanitize agent name to be a valid Python identifier for AutoGen v0.4.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: sanitize_agent_name_for_autogen_v4"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def sanitize_agent_name_for_autogen_v4(name: Any) -> Any
```

## Parameters

<ParamField query="name" type="Any" required={true}>
  The original agent name
</ParamField>

### Returns

<ResponseField name="Returns" type="Any">
  A valid Python identifier
</ResponseField>

## Uses

* `re.sub`
* `sanitized.rstrip`
* `isdigit`
* `keyword.iskeyword`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai/praisonai/agents_generator.py#L128">
  `praisonai/agents_generator.py` at line 128
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/features/autoagents" />
</CardGroup>
