Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

3.9 KB
Raw Blame
# Generated by Django 5.2.17 on 2026-08-11 12:42

import uuid

import django.utils.timezone
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("posthog", "1297_add_instagram_integration_kind"),
        ("tasks", "0100_alter_loop_origin_product_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="AgentPeerMessage",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("content", models.TextField()),
                ("artifact_ids", models.JSONField(blank=True, default=list)),
                (
                    "outcome",
                    models.CharField(
                        choices=[
                            ("accepted", "Accepted"),
                            ("signaled", "Signaled"),
                            ("delivered", "Delivered"),
                            ("rejected", "Rejected"),
                            ("target_finished", "Target finished"),
                            ("delivery_failed", "Delivery failed"),
                        ],
                        default="accepted",
                        max_length=20,
                    ),
                ),
                (
                    "failure_phase",
                    models.CharField(blank=True, default="", max_length=50),
                ),
                ("failure_detail", models.TextField(blank=True, default="")),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "sender_run",
                    models.ForeignKey(
                        db_index=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="sent_peer_messages",
                        to="tasks.taskrun",
                    ),
                ),
                (
                    "sender_user",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "target_run",
                    models.ForeignKey(
                        db_index=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="received_peer_messages",
                        to="tasks.taskrun",
                    ),
                ),
                (
                    "team",
                    models.ForeignKey(
                        db_constraint=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="posthog.team",
                    ),
                ),
            ],
            options={
                "db_table": "posthog_agent_peer_message",
                "indexes": [
                    models.Index(
                        fields=["target_run", "outcome", "created_at"],
                        name="peer_msg_target_outcome_idx",
                    ),
                    models.Index(
                        fields=["sender_run", "created_at"],
                        name="peer_msg_sender_created_idx",
                    ),
                ],
            },
        ),
    ]