Events & Communication
How AnyaSelf microservices interact.
Internal Communication Flow
AnyaSelf relies heavily on the Orchestrator reaching out to other microservices sequentially or concurrently as the Vertex AI Langchain agent decides on its "Tools."
Because the stack relies on synchronous HTTP and gRPC rather than a unified message bus (like Kafka), it utilizes a webhooks & polling approach to bridge the asynchronous gaps.
Example: The Styling & Automation Flow
- User Request: The React client hits
POST /missions/{mission_id}/chaton the api-gateway, which is forwarded to the orchestrator. - LLM Loop Start: The Orchestrator's Vertex AI Agent thinks, and decides it needs to see what the user owns.
- Internal Tool Call (1): The Orchestrator fires an internal synchronous
GET /itemsto the wardrobe service. - Internal Tool Call (2): The Orchestrator decides a new piece is needed, and fires a synchronous
POST /searchto the commerce service. - Session Bootstrap: The Orchestrator uses the
create_hyperbeam_sessiontool, hitting the hyperbeam-bridge to spin up an ephemeral cloud Chromium instance. - Streaming Return: The Orchestrator streams the reasoning and final tool output (the Hyperbeam URL) back to the user via Server-Sent Events (SSE).
- DOM Polling: The Agent (or User) now directly hits the hyperbeam-bridge looking for
GET /elementsand submittingPOST /agent-action. - Logging: After the flow terminates, the Orchestrator hits the artifacts-audit service to store a permanent
transcriptandoutcome-summary.
Internal Auth (X-Internal-Token)
Because the microservices must trust each other (e.g., the Orchestrator must be able to read Wardrobe data without the User's explicit JWT token on every sub-call), services accept an X-Internal-Token HTTP header.
This token must match the <SERVICE>_INTERNAL_TOKEN defined in each .env file to bypass standard JWT verification barriers.