Skip to content

Conversation

@mmabrouk
Copy link
Member

@mmabrouk mmabrouk commented Feb 3, 2026

Summary

This PR implements Phase 1 and Phase 1b of the Chat Interface RFC, enabling custom workflows to explicitly declare themselves as chat applications via a flags parameter.

Changes

Legacy System (serving.py):

  • Add flags: Optional[Dict[str, Any]] parameter to @ag.route, @ag.entrypoint, and create_app()'s isolated_route
  • Emit x-agenta-flags on /run and /test OpenAPI operations
  • Update builtin chat service to set flags={"is_chat": True}

New Workflow System (routing.py):

  • Add flags: Optional[dict] parameter to @ag.route
  • Propagate flags to auto_workflow() so they flow to /inspect response

Models:

  • Add is_chat: bool = False to WorkflowFlags in SDK (sdk/agenta/sdk/models/workflows.py)
  • Add is_chat: bool = False to WorkflowFlags in API (api/oss/src/core/workflows/dtos.py)

Design Docs:

  • Add docs/design/chat-interface-rfc/ with research, plan, and status

Usage

# Legacy system (user-facing custom workflows)
@ag.route("/", config_schema=Config, flags={"is_chat": True})
async def chat_handler(messages: List[ag.Message]) -> ag.Message:
    ...

# New workflow system
@ag.route("/", flags={"is_chat": True})
def my_chat_workflow(messages):
    ...

OpenAPI Output

paths:
  /run:
    post:
      x-agenta-flags:
        is_chat: true

Testing

  • Manually tested deployment at http://144.76.237.122:8180
  • Verified x-agenta-flags.is_chat: true appears in /services/chat/openapi.json

Next Steps (Phase 2)

Frontend changes to read x-agenta-flags.is_chat for chat detection (with heuristics fallback).


Open with Devin

… chat detection

- Add flags parameter to legacy @ag.route/@ag.entrypoint decorators (serving.py)
- Emit x-agenta-flags on /run and /test OpenAPI operations
- Add flags parameter to new @ag.route decorator (routing.py) and propagate to auto_workflow()
- Add is_chat to WorkflowFlags model in SDK and API
- Update builtin chat service to set flags={"is_chat": True}
- Add design docs for chat-interface RFC

This enables custom workflows to explicitly declare is_chat: true, which the frontend can read from OpenAPI to determine chat UI mode.
@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Feb 9, 2026 7:27pm

Request Review

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Feb 3, 2026
@dosubot dosubot bot added the SDK label Feb 3, 2026
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View issue and 5 additional flags in Devin Review.

Open in Devin Review

Ensure @ag.route(flags=...) applies even when decorating an existing workflow and emit flags under x-agenta.flags (keeping x-agenta-flags as a temporary alias).
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

View 14 additional findings in Devin Review.

Open in Devin Review

Emit chat flags only under x-agenta.flags to avoid duplicate vendor extensions and ensure frontend discovery reads the canonical namespace.
…date RFC docs

- Fix RuntimeError in application.__init__: iterating over kwargs['references']
  while deleting keys matching 'evaluator_*' caused dict size change during iteration.
  Now builds key list first via list comprehension.
- Fix same bug in evaluator.__init__ for keys matching 'application_*'.
- Update status.md with cross-PR tracking table and progress log.
- Mark Phase 1 + 1b as done in plan.md definition of done.
mmabrouk added a commit that referenced this pull request Feb 9, 2026
The SDK (PR #3622) changed the OpenAPI vendor extension from a flat
'x-agenta-flags' key to a nested 'x-agenta: {flags: {...}}' structure.
Update _get_openapi_chat_flag to read from the new nested path.

Also removes unused imports (common, make_hash_id) caught by ruff.
mmabrouk added a commit that referenced this pull request Feb 9, 2026
The SDK (PR #3622) changed the OpenAPI vendor extension from a flat
'x-agenta-flags' key to a nested 'x-agenta: {flags: {...}}' structure.
Update _get_openapi_chat_flag to read from the new nested path.

Also removes unused imports (common, make_hash_id) caught by ruff.
@mmabrouk mmabrouk requested a review from junaway February 9, 2026 23:01
mmabrouk added a commit that referenced this pull request Feb 9, 2026
Update all 4 frontend chat detection paths to prefer the explicit
x-agenta.flags.is_chat flag from the SDK's OpenAPI extension, falling
back to the existing messages-property heuristic for older apps.

Detection paths updated:
- genericTransformer/index.ts: detectChatVariantFromOpenAISchema()
- appRevision/api/schema.ts: extractAllEndpointSchemas()
- appRevision + legacyAppRevision runnableSetup.ts: isChatVariantAtomFamily
  (now reads pre-computed isChatVariant from schema state)
- requestSchemaMeta.ts: hasMessages computation

Stacked on PR #3622 (SDK flags support).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SDK size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants