-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (20 loc) · 736 Bytes
/
Copy pathmain.py
File metadata and controls
31 lines (20 loc) · 736 Bytes
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
30
from fastapi import FastAPI
import inngest
import inngest.fast_api
from app.config.settings import settings
from app.inngest_client import inngest_client
from app.schemas import ResearchRequest
from app.workflows.research_workflow import research_loop
app = FastAPI(title="Python AutoResearch")
@app.get("/")
async def health() -> dict[str, str]:
return {"status": "ok"}
@app.post("/research")
async def start_research(payload: ResearchRequest) -> dict:
event = inngest.Event(
name= "research/requested",
data= payload.model_dump(),
)
event_ids = await inngest_client.send(event)
return {"queued": True, "event_ids": event_ids}
inngest.fast_api.serve(app, inngest_client, [research_loop])