File size: 861 Bytes
c65d50c
660ad8c
c65d50c
660ad8c
c65d50c
 
 
660ad8c
c65d50c
 
 
660ad8c
c65d50c
 
 
660ad8c
c65d50c
 
 
660ad8c
c65d50c
 
 
 
 
 
 
660ad8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from fastapi import FastAPI

api_app = FastAPI()

@api_app.post("/agent1")
async def agent1_endpoint(message: dict):
    return {"agent": "agent1", "response": f"Processed: {message['text']}"}

@api_app.post("/agent2")
async def agent2_endpoint(message: dict):
    return {"agent": "agent2", "response": f"Processed: {message['text']}"}

@api_app.post("/agent3")
async def agent3_endpoint(message: dict):
    return {"agent": "agent3", "response": f"Processed: {message['text']}"}

@api_app.post("/agent4")
async def agent4_endpoint(message: dict):
    return {"agent": "agent4", "response": f"Processed: {message['text']}"}

@api_app.post("/run_all")
async def run_all_endpoint(message: dict):
    responses = [
        {"agent": f"agent{i}", "response": f"Processed: {message['text']}"}
        for i in range(1, 5)
    ]
    return {"responses": responses}