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.

1.1 KB
Raw Blame
from posthog.api.routing import RouterRegistry

from products.context_layer.backend.presentation.selection import ContextSelectionViewSet
from products.context_layer.backend.presentation.views import ContextLayerAgentViewSet, ContextLayerViewSet


def register_routes(routers: RouterRegistry) -> None:
    routers.projects.register(r"context_layer/selection", ContextSelectionViewSet, "context_selection", ["team_id"])
    routers.organizations.register(
        r"context_layer", ContextLayerViewSet, "organization_context_layer", ["organization_id"]
    )
    # A run token carries `scoped_teams`, which APIScopePermission accepts only on a
    # project-nested route, so runs reach the same wiki here. The `/agent` segment
    # keeps this path's suffix distinct from the organization one above: an org path
    # whose suffix matches a project path is treated as a legacy alias and gets
    # deprecated, which would retire the human route and take its operation ids.
    routers.projects.register(r"context_layer/agent", ContextLayerAgentViewSet, "project_context_layer", ["team_id"])