Query
Run bioinformatics queries through the AI agent. Supports synchronous and streaming modes.
POST
/v1/queryScope: querySynchronous query — waits for the agent to finish and returns the full response.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | The bioinformatics query or instruction |
| conversation_id | string | No | Session ID to continue a previous conversation |
| workspace_id | string | No* | Required if key is scoped to specific workspaces |
response = client.query.run(
"Find BRCA1 variants associated with breast cancer",
workspace_id="ws_abc123",
)
print(response.answer)const response = await client.query.run({
prompt: 'Find BRCA1 variants associated with breast cancer',
workspaceId: 'ws_abc123',
});
console.log(response.answer);curl -X POST https://api.smarts.bio/v1/query \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Find BRCA1 variants associated with breast cancer",
"workspace_id": "ws_abc123"
}'# --no-stream waits for the full answer (like POST /v1/query) smarts query "Find BRCA1 variants associated with breast cancer" \ --workspace ws_abc123 --no-stream
POST
/v1/query/streamScope: queryStreaming query — returns Server-Sent Events as the agent processes the request. Same request body as /v1/query.
SSE Event Types
| type | Description |
|---|---|
| status | Processing status update (e.g., "Searching databases...") |
| content | Text content to display to the user |
| tool_call | A tool was invoked by the agent |
| done | Stream is complete — no more events |
| error | An error occurred during processing |
for chunk in client.query.stream("Run BLAST for ATGCGTAACCGTAA"):
if chunk.type == "status":
print(f"[{chunk.status}]")
elif chunk.type == "content":
print(chunk.content, end="", flush=True)
elif chunk.type == "done":
print("\nComplete.")for await (const chunk of client.query.stream({
prompt: 'Run BLAST for ATGCGTAACCGTAA',
})) {
if (chunk.type === 'status') console.log(`[${chunk.status}]`);
if (chunk.type === 'content') process.stdout.write(chunk.content ?? '');
if (chunk.type === 'done') console.log('\nComplete.');
}curl -X POST https://api.smarts.bio/v1/query/stream \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"prompt": "Run BLAST for ATGCGTAACCGTAA"}'
# Events:
# data: {"type":"status","status":"Running BLAST search..."}
# data: {"type":"content","content":"Found 12 significant hits..."}
# data: {"type":"done"}# Streams progress to your terminal, then prints the answer smarts query "Run BLAST for ATGCGTAACCGTAA"