{
    "$schema": "../../../../schemas/diagram-spec.schema.json",
    "schemaVersion": "1.0",
    "id": "ai-agent-system",
    "title": "GPT-Live system architecture",
    "description": "Reference-style architecture diagram for a realtime media path and delegated reasoning path.",
    "language": "en",
    "legend": [
        {
            "label": "Real-time media path",
            "variant": "realtime"
        },
        {
            "label": "Async delegation path",
            "variant": "delegated"
        }
    ],
    "nodes": [
        {
            "id": "user",
            "type": "actor",
            "variant": "realtime",
            "status": "stable",
            "title": "USER",
            "icon": "user"
        },
        {
            "id": "media-frontend",
            "type": "frontend",
            "variant": "realtime",
            "status": "stable",
            "title": "MEDIA\nFRONTEND",
            "icon": "monitor"
        },
        {
            "id": "live-model",
            "type": "model",
            "variant": "realtime",
            "status": "stable",
            "title": "GPT-LIVE-1\nMODEL INSTANCE",
            "subtitle": "Voice model",
            "icon": "waveform"
        },
        {
            "id": "application-server",
            "type": "backend",
            "variant": "delegated",
            "status": "stable",
            "title": "APPLICATION\nSERVER",
            "subtitle": "Delegation and business logic",
            "icon": "database"
        },
        {
            "id": "reasoning-model",
            "type": "model",
            "variant": "delegated",
            "status": "stable",
            "title": "REASONING\nMODEL INSTANCE",
            "subtitle": "Text model",
            "icon": "spark"
        },
        {
            "id": "tools",
            "type": "tool",
            "variant": "delegated",
            "status": "stable",
            "title": "TOOLS",
            "icon": "tools",
            "controls": [
                "Search",
                "Code",
                "Retrieval"
            ]
        }
    ],
    "edges": [
        {
            "id": "user-audio",
            "from": "user",
            "to": "media-frontend",
            "type": "realtime-stream",
            "variant": "realtime",
            "label": "USER AUDIO",
            "direction": "forward",
            "protocol": "WebRTC"
        },
        {
            "id": "assistant-audio",
            "from": "media-frontend",
            "to": "user",
            "type": "realtime-stream",
            "variant": "realtime",
            "label": "ASSISTANT AUDIO",
            "direction": "forward",
            "protocol": "WebRTC"
        },
        {
            "id": "media-to-live",
            "from": "media-frontend",
            "to": "live-model",
            "type": "realtime-stream",
            "variant": "realtime",
            "direction": "forward",
            "protocol": "WebRTC"
        },
        {
            "id": "live-to-media",
            "from": "live-model",
            "to": "media-frontend",
            "type": "realtime-stream",
            "variant": "realtime",
            "direction": "forward",
            "protocol": "WebRTC"
        },
        {
            "id": "delegation-request",
            "from": "media-frontend",
            "to": "application-server",
            "type": "async-request",
            "variant": "delegated",
            "label": "DELEGATION REQUEST",
            "direction": "forward"
        },
        {
            "id": "guidance-to-frontend",
            "from": "reasoning-model",
            "to": "media-frontend",
            "type": "async-request",
            "variant": "delegated",
            "label": "RESULTS / GUIDANCE",
            "direction": "forward"
        },
        {
            "id": "app-request",
            "from": "application-server",
            "to": "reasoning-model",
            "type": "async-request",
            "variant": "delegated",
            "label": "REQUEST",
            "direction": "forward"
        },
        {
            "id": "model-result",
            "from": "reasoning-model",
            "to": "application-server",
            "type": "async-request",
            "variant": "delegated",
            "label": "RESULTS / GUIDANCE",
            "direction": "forward"
        },
        {
            "id": "model-to-tools",
            "from": "reasoning-model",
            "to": "tools",
            "type": "async-request",
            "variant": "delegated",
            "direction": "forward"
        },
        {
            "id": "tools-to-model",
            "from": "tools",
            "to": "reasoning-model",
            "type": "async-request",
            "variant": "delegated",
            "direction": "forward"
        }
    ]
}
