Skip to content

Add Unified HTTP Request Path Prefix for a2a Server #83

@magicbrighter

Description

@magicbrighter

Description

I would like to add a unified HTTP request path prefix to the existing Fusion AI Server to make all API endpoints accessible under a common root path (e.g., /fusion or /api/v1/...).

Current Behavior

The A2A server currently exposes endpoints directly at:

  • /a2a/tasks
  • /a2a/agent
  • /a2a/state
  • /a2a/events

Desired Behavior

I want all endpoints to be accessible under a unified prefix, for example:

  • /fusion/a2a/tasks
  • /fusion/a2a/agent
  • /fusion/a2a/state
  • /fusion/a2a/events

Proposed Solution

Modify the run_server call in main() to include a root_path parameter:

Current code:

run_server(server, host="0.0.0.0", port=port)

Proposed change:

run_server(
    server,
    host="0.0.0.0", 
    port=port,
    root_path="/fusion"  # Add unified path prefix
)

Benefits

  1. Better API Organization: All endpoints under a common namespace
  2. A2A Compatibility: No breaking changes to existing A2A functionality
  3. Future Extensibility: Easy to add custom endpoints like /fusion/search
  4. Flexible Configuration: Root path can be easily customized (/api/v1, /myapi, etc.)

Additional Features (Optional)

This change would also enable adding custom REST APIs alongside A2A:

  • /fusion/search - Custom search endpoint
  • /fusion/models - Model management
  • /fusion/health - Health check endpoint

Implementation

The solution requires minimal code changes and maintains full backward compatibility with the A2A framework while providing a cleaner, more organized API structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions