agentscope-ai / agentscope-ai/agentscope-runtime

[Feature] Add Hooks/Decorators for FastAPI Middleware in AgentApp

Aberta
#293 4 comentários 0 reações 1 responsável Reivindicada por @zhilingluo Ver no GitHub
enhancement
Linguagem predominante
Python
Estrelas
863
Forks
168
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

## Problem Description

Currently, `agentscope_runtime.engine.AgentApp` leverages `FastAPIAppFactory.create_app` to instantiate a FastAPI application instance for serving agent-related endpoints. However, there is no built-in mechanism (e.g., hooks, decorators, or callback functions) to inject custom FastAPI middleware into the created app instance.

Developers who need to add middleware (e.g., logging, authentication, ~~CORS~~ customization, request/response interceptors) to the FastAPI app have to either:
Modify the internal implementation of FastAPIAppFactory (not maintainable), or
Recreate the app instance manually (defeats the purpose of AgentApp abstraction).

## Proposed Solution

to be discussed.

## Affected Component(s)
- [x] Engine
- [ ] Sandbox
- [ ] Common
- [ ] Tools
- [ ] Documentation
- [ ] Other: ___________

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.