> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/developer-guide/classic-api/data-access/organization-tables/dynamic-behaviors.md).

# Dynamic Behaviors

Schema reference for the tables that hold dynamic behavior configurations, their versioned trigger and action definitions, and the record of each invocation at runtime.

{% hint style="warning" %}
These tables and commands belong to the Classic API and legacy Agent Forge workflow. The Platform API does not expose or execute dynamic behavior sets; use Platform Context Graph configuration instead.
{% endhint %}

## CLI Management

Dynamic behaviors are first-class assets in Agent Forge (v0.2.25+), which means you can discover and manage them end to end from the CLI.

### Discovery Commands

```bash
# List all dynamic behaviors
forge asset behavior list -e production

# View version history for a behavior
forge asset behavior version-list "Emergency Response Protocol" -e production

# Show detailed behavior version info
forge asset behavior version-show "Emergency Response Protocol" 3 -e production
```

### Invocation History

Check when and where a behavior was triggered across conversations:

```bash
# List recent invocations by name
forge asset behavior invocations "Emergency Response Protocol" -e production

# Limit results
forge asset behavior invocations "Emergency Response Protocol" -e production -n 10

# JSON output (includes conversation_id, service_id, user_id, version info)
forge asset behavior invocations "Emergency Response Protocol" -e production --json
```

Output shows the `invoked_at` timestamp, conversation ID, service ID, user ID, and behavior version for each trigger event. It's useful for verifying triggers fire correctly and for auditing activation frequency.

### Service Integration

```bash
# View services with applied behaviors
forge service show MyService -e production
# Output includes:
#   Dynamic Behaviors: 3 applied
#     - Emergency Response Protocol (id123) ✓
#     - Calorie Target Guidance (id456) ✓
#     - Safety Screening (id789) ✗

# View behaviors in version sets
forge version-set show release -s MyService -e production
# Shows: Applied Behaviors: [behavior1, behavior2, ...]
```

### Dynamic Behavior Sets Table

**Table Name:** `dynamic_behavior_sets` **Description:** Dynamic behavior configurations for services

{% tabs %}
{% tab title="Schema" %}

| Column                    | Type           | Description                   |
| ------------------------- | -------------- | ----------------------------- |
| `_id`                     | string         | Behavior set identifier       |
| `applied_to_services`     | array\<string> | Associated service IDs        |
| `created_at`              | timestamp      | Creation timestamp            |
| `creator_user_id`         | string         | Creator user ID               |
| `is_active`               | boolean        | Active status                 |
| `is_deleted`              | boolean        | Deletion status               |
| `latest_version_triggers` | json           | Current trigger configuration |
| `name`                    | string         | Behavior set name             |
| `org_id`                  | string         | Organization identifier       |
| `region_name`             | string         | Deployment region             |
| `tags`                    | json           | Associated tags               |
| `updated_at`              | timestamp      | Last update timestamp         |
| `updated_by_user_id`      | string         | Last updater user ID          |
| {% endtab %}              |                |                               |

{% tab title="Query Example" %}

```sql
SELECT
  _id,
  name,
  applied_to_services,
  is_active,
  updated_at
FROM dynamic_behavior_sets
WHERE is_active = true
  AND is_deleted = false;
```

{% endtab %}
{% endtabs %}

### Dynamic Behavior Set Versions Table

**Table Name:** `dynamic_behavior_set_versions` **Description:** Version history, triggers, and actions for dynamic behavior sets

{% tabs %}
{% tab title="Schema" %}

| Column                    | Type           | Description                                                      |
| ------------------------- | -------------- | ---------------------------------------------------------------- |
| `_id`                     | string         | Version identifier                                               |
| `actions`                 | json           | Action definitions for this version                              |
| `additional_instruction`  | string         | Additional instruction from tool-related actions                 |
| `conversation_triggers`   | array\<string> | Trigger conditions                                               |
| `created_at`              | timestamp      | Creation timestamp                                               |
| `dynamic_behavior_set_id` | string         | Parent behavior set ID                                           |
| `instruction`             | string         | Injected instruction (if configured)                             |
| `org_id`                  | string         | Organization identifier                                          |
| `overrides_instructions`  | boolean        | Whether the injected instruction overrides existing instructions |
| `region_name`             | string         | Deployment region                                                |
| `updated_at`              | timestamp      | Last update timestamp                                            |
| `version`                 | integer        | Version number                                                   |
| {% endtab %}              |                |                                                                  |

{% tab title="Query Example" %}

```sql
SELECT
  dynamic_behavior_set_id,
  version,
  conversation_triggers,
  instruction
FROM dynamic_behavior_set_versions
ORDER BY version DESC;
```

{% endtab %}
{% endtabs %}

### Dynamic Behavior Invocations Table

**Table Name:** `dynamic_behavior_invocations` **Description:** Records of triggered dynamic behaviors in conversations

{% tabs %}
{% tab title="Schema" %}

| Column                              | Type           | Description                |
| ----------------------------------- | -------------- | -------------------------- |
| `_id`                               | string         | Invocation identifier      |
| `agent_inner_thoughts_ids`          | array\<string> | Agent thought IDs          |
| `agent_message_id`                  | string         | Agent message ID           |
| `conversation_id`                   | string         | Associated conversation ID |
| `created_at`                        | timestamp      | Creation timestamp         |
| `dynamic_behavior_set_version_info` | json           | Version information        |
| `external_event_message_ids`        | array\<string> | External event IDs         |
| `initial_message_id`                | string         | Initial message ID         |
| `invoked_at`                        | timestamp      | Invocation timestamp       |
| `org_id`                            | string         | Organization identifier    |
| `region_name`                       | string         | Deployment region          |
| `service_id`                        | string         | Associated service ID      |
| `updated_at`                        | timestamp      | Last update timestamp      |
| `user_id`                           | string         | Associated user ID         |
| {% endtab %}                        |                |                            |

{% tab title="Query Example" %}

```sql
SELECT
  conversation_id,
  service_id,
  user_id,
  invoked_at,
  dynamic_behavior_set_version_info
FROM dynamic_behavior_invocations
ORDER BY invoked_at DESC;
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/developer-guide/classic-api/data-access/organization-tables/dynamic-behaviors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
