agent

Chat With Agent

Chat endpoint using ReAct agent for autonomous source selection.

The agent autonomously selects appropriate tools (PubMed, Scopus, clinical trials, etc.) based on the user's query and patient context. No manual connector selection.

Supports per-session conversation memory:

  • If session_id provided, loads prior conversation history
  • Saves user message and agent response after invocation
  • Returns session_id for frontend to continue conversation

Returns: AgentsetChatResponse with agent's response, evidence sources, and session_id.

post/agent/chat

Request

  • Base URL
    https://api.alpha-grid.ai (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Request body

patient_contextunknown
session_idstring nullable
patient_idinteger nullable
custom_system_promptstring nullable

Response

Successful Response

contentstring required

The agent's response to the user

sourcesobject[] nullable

Search result sources

evidence_sourcesobject[] nullable

Evidence sources extracted from tool calls

session_idstring nullable

Session ID for continuing conversation

statusstring

Response status: success, error, etc.

usage_infoobject nullable

Token usage and cost information for this request

Example response

{
  "agent_steps": [
    {
      "action_type": "thinking",
      "step_num": 1,
      "thinking_text": "Searching medical literature for treatment options..."
    },
    {
      "action_type": "tool_call",
      "step_num": 2,
      "tool_name": "pubmed_search",
      "tool_query": "{\"query\": \"NSCLC immunotherapy\"}"
    },
    {
      "action_type": "result",
      "result_summary": "Found 15 papers on combination immunotherapy for NSCLC",
      "step_num": 3,
      "tool_name": "pubmed_search"
    }
  ],
  "content": "Based on the literature, checkpoint inhibitor combinations are effective...",
  "session_id": "session-uuid-123",
  "status": "success"
}

Changes

No recorded changes to this operation across all 1 revision of this API.