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

# Governance

> Risk classification, policies, approvals, and audit trail via the SDK

## classify\_risk()

Assign an EU AI Act risk level to an agent.

```python theme={null}
classification = client.classify_risk(
    agent_id="agt_abc123",
    risk_level="high",
    justification="Processes employee performance data for HR decisions",
    assessed_by="compliance-team",
)
```

<ParamField path="agent_id" type="string" required>
  Agent ID
</ParamField>

<ParamField path="risk_level" type="string" required>
  Risk level: `minimal`, `limited`, `high`, `unacceptable`
</ParamField>

<ParamField path="justification" type="string" required>
  Reason for the classification
</ParamField>

<ParamField path="assessed_by" type="string" required>
  Identifier of the person or system performing the assessment
</ParamField>

<ParamField path="domain_tags" type="array">
  Optional list of domain tags associated with the classification
</ParamField>

<ParamField path="ai_act_categories" type="array">
  Optional list of EU AI Act categories associated with the classification
</ParamField>

See [Risk Classification](/governance/risk-classification) for details on each level.

## create\_policy()

Create a governance policy.

```python theme={null}
policy = client.create_policy(
    name="production-model-allowlist",
    policy_type="model_allowlist",
    rules={"allowed_models": ["gpt-4o", "claude-sonnet-4-20250514"]},
    conditions={"environments": ["production"]},
    enabled=True,
)
```

<ParamField path="name" type="string" required>
  Policy name
</ParamField>

<ParamField path="policy_type" type="string" required>
  One of: `model_allowlist`, `block_provider`, `require_approval`, `budget_limit`, `rate_limit`, `require_human_review`, `prompt_injection`, `pii_filter`
</ParamField>

<ParamField path="rules" type="dict" required>
  Policy rules (varies by type; must be non-empty)
</ParamField>

<ParamField path="conditions" type="dict">
  Optional scoping: `agent_ids`, `team_ids`, `environments`, `risk_levels`
</ParamField>

<ParamField path="priority" type="integer" default="100">
  Evaluation priority, 1 to 1000
</ParamField>

<ParamField path="enabled" type="boolean" default="true">
  Whether the policy is active
</ParamField>

See [Policies](/governance/policies) for all policy types, rules keys, and the enforcement model.

## list\_approvals()

List HITL approval items.

```python theme={null}
# All pending approvals
pending = client.list_approvals(status="pending")

# All approvals for an agent
agent_approvals = client.list_approvals(agent_id="agt_abc123")
```

<ParamField path="status" type="string">
  Filter by status: `pending`, `approved`, `denied`, `expired`
</ParamField>

<ParamField path="agent_id" type="string">
  Filter by agent ID
</ParamField>

<ParamField path="limit" type="integer" default="20">
  Results per page
</ParamField>

See [HITL Approvals](/governance/approvals) for the full workflow.

## decide\_approval()

Approve or deny a pending approval item.

```python theme={null}
# Approve
client.decide_approval(
    12345,
    decision="approved",
    reviewer_id="reviewer-jane",
    reason="Agent configuration verified",
)

# Deny
client.decide_approval(
    12345,
    decision="denied",
    reviewer_id="reviewer-jane",
    reason="Agent not authorized for production",
)
```

<ParamField path="request_id" type="integer" required>
  Approval request ID
</ParamField>

<ParamField path="decision" type="string" required>
  `approved` or `denied`
</ParamField>

<ParamField path="reviewer_id" type="string" required>
  Identifier of the reviewer making the decision
</ParamField>

<ParamField path="reason" type="string">
  Reason for the decision (recorded in audit trail)
</ParamField>

## Additional Methods

One-line reference for other governance methods.

| Method                                                                                 | Description                                                                  |
| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `get_risk_classification(agent_id)`                                                    | Get current risk classification for an agent.                                |
| `get_risk_suggestion(agent_id)`                                                        | Get AI-assisted risk level suggestion based on agent metadata.               |
| `list_risk_classifications(**params)`                                                  | List all risk classifications. Supports risk\_level, page, limit.            |
| `get_policy(policy_id)`                                                                | Get a single policy.                                                         |
| `update_policy(policy_id, **fields)`                                                   | Update policy fields such as name, enabled, priority, conditions, and rules. |
| `delete_policy(policy_id)`                                                             | Delete a governance policy.                                                  |
| `list_policies(**params)`                                                              | List governance policies. Supports policy\_type, enabled, page, limit.       |
| `evaluate_policies(agent_id, provider, model, team_id=None, environment="production")` | Dry-run evaluate all policies against a request context.                     |
| `get_pending_count()`                                                                  | Get count of pending approval requests.                                      |

## list\_audit\_events()

Query the immutable audit trail.

```python theme={null}
# Recent events
events = client.list_audit_events(limit=50)

# Filtered
events = client.list_audit_events(
    event_type="policy.violated",
    target_id="agt_abc123",
    from_date="2026-03-01T00:00:00Z",
    to_date="2026-03-17T23:59:59Z",
    limit=100,
)
```

<ParamField path="event_type" type="string">
  Filter by event type (e.g., `agent.registered`, `policy.violated`)
</ParamField>

<ParamField path="target_id" type="string">
  Filter by target entity ID
</ParamField>

<ParamField path="from_date" type="string">
  Start of time range (ISO 8601)
</ParamField>

<ParamField path="to_date" type="string">
  End of time range (ISO 8601)
</ParamField>

<ParamField path="limit" type="integer" default="50">
  Results per page
</ParamField>

See [Audit Trail](/governance/audit-trail) for all event types and export options.
