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

# Parse Policy String • AI Agent SDK

> parse_policy_string: Parse a policy string into type and action. O(1) operation.

# parse\_policy\_string

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

> This function is defined in the [**parse\_utils**](../modules/parse_utils) module.

Parse a policy string into type and action. O(1) operation.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def parse_policy_string(value: str) -> tuple
```

## Parameters

<ParamField query="value" type="str" required={true}>
  Policy string (e.g., "policy:strict", "pii:redact")
</ParamField>

### Returns

<ResponseField name="Returns" type="tuple">
  Tuple of (policy\_type, action)
</ResponseField>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
>>> parse_policy_string("policy:strict")
    ('policy', 'strict')
    >>> parse_policy_string("pii:redact")
    ('pii', 'redact')
```

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/config/parse_utils.py#L301">
  `praisonaiagents/config/parse_utils.py` at line 301
</Card>
