Literature & Databases
Search PubMed, patent databases, and cross-reference multiple sources using direct tool calls.
PubMed literature search
Run a structured PubMed search and download the results as a BibTeX or CSV reference list.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
# Direct PubMed search — structured output
result = client.tools.run(
tool_id="ncbi_search",
input={
"database": "pubmed",
"query": (
"(CRISPR OR cas9) AND (cancer OR tumor) "
"AND clinical[Title] AND 2022:2025[PDAT]"
),
"maxResults": 20,
"sort": "relevance",
"workspace_id": ws_id,
"output_path": "literature/",
"output_format": "bibtex",
},
)
print(f"Total hits : {result['total_hits']}")
print(f"Returned : {result['n_returned']}")
for paper in result["articles"][:3]:
print(f" [{paper['pmid']}] {paper['title'][:70]}...")
print(f" {paper['journal']} {paper['year']} PMID:{paper['pmid']}")
# Download BibTeX file
bib = client.files.download(result["output_path"], workspace_id=ws_id, dest="./refs/")
print(f"BibTeX saved to {bib}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const result = await client.tools.run('ncbi_search', {
input: {
database: 'pubmed',
query: '(CRISPR OR cas9) AND (cancer OR tumor) AND clinical[Title] AND 2022:2025[PDAT]',
maxResults: 20,
sort: 'relevance',
workspaceId: workspace.id,
outputPath: 'literature/',
outputFormat: 'bibtex',
},
});
console.log('Total hits :', result.totalHits);
result.articles.slice(0, 3).forEach((p: { pmid: string; title: string; journal: string; year: number }) => {
console.log(` [${p.pmid}] ${p.title.slice(0, 70)}...`);
console.log(` ${p.journal} ${p.year}`);
});
const bib = await client.files.download(result.outputPath, workspace.id, './refs/');
console.log('BibTeX saved to', bib);curl -X POST https://api.smarts.bio/v1/tools/ncbi_search/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"database": "pubmed",
"query": "(CRISPR OR cas9) AND cancer AND clinical[Title] AND 2022:2025[PDAT]",
"maxResults": 20,
"sort": "relevance"
}
}'# Structured PubMed search, exported as BibTeX smarts tool run ncbi_search \ --param database=pubmed \ --param "query=(CRISPR OR cas9) AND (cancer OR tumor) AND clinical[Title] AND 2022:2025[PDAT]" \ --param maxResults=20 \ --param sort=relevance \ --param output_path=literature/ \ --param output_format=bibtex # Download the BibTeX file smarts file download literature/ -o ./refs/
Patent prior art search
Search Google Patents for prior art on a bioinformatics method and download a summary report.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
# Patent prior art search
patents = client.tools.run(
tool_id="patent_search",
input={
"query": "lipid nanoparticle mRNA delivery CRISPR",
"offices": ["US", "EP", "WO"],
"date_from": "2018-01-01",
"date_to": "2025-01-01",
"max_results": 25,
"workspace_id": ws_id,
"output_path": "patents/",
},
)
print(f"Patents found: {patents['total_found']}")
for p in patents["results"][:3]:
print(f" [{p['patent_number']}] {p['title'][:60]}...")
print(f" Assignee: {p['assignee']} Filed: {p['filing_date']}")
# Download patent summary report
report = client.files.download(patents["report_path"], workspace_id=ws_id, dest="./patents/")
print(f"Report saved to {report}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const patents = await client.tools.run('patent_search', {
input: {
query: 'lipid nanoparticle mRNA delivery CRISPR',
offices: ['US', 'EP', 'WO'],
dateFrom: '2018-01-01',
dateTo: '2025-01-01',
maxResults: 25,
workspaceId: workspace.id,
outputPath: 'patents/',
},
});
console.log('Patents found:', patents.totalFound);
patents.results.slice(0, 3).forEach((p: { patent_number: string; title: string; assignee: string; filing_date: string }) => {
console.log(` [${p.patent_number}] ${p.title.slice(0, 60)}...`);
console.log(` Assignee: ${p.assignee} Filed: ${p.filing_date}`);
});
const report = await client.files.download(patents.reportPath, workspace.id, './patents/');
console.log('Report saved to', report);curl -X POST https://api.smarts.bio/v1/tools/patent_search/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"query": "lipid nanoparticle mRNA delivery CRISPR",
"offices": ["US", "EP", "WO"],
"date_from": "2018-01-01",
"date_to": "2025-01-01",
"max_results": 25
}
}' | jq '{total_found, results: .results[:3] | map({patent_number, title, assignee, filing_date})}'# Search Google Patents for prior art smarts tool run patent_search \ --param query="lipid nanoparticle mRNA delivery CRISPR" \ --param offices=US,EP,WO \ --param date_from=2018-01-01 \ --param date_to=2025-01-01 \ --param max_results=25 \ --param output_path=patents/ # Download the patent summary report smarts file download patents/ -o ./patents/
Cross-database evidence synthesis
Gather evidence from PubMed, ClinVar, and STRING in separate tool calls, then stream the agent's synthesis into a single report.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
gene = "IDH1"
variant = "R132H"
# Step 1: literature
lit = client.tools.run(
tool_id="ncbi_search",
input={"database": "pubmed", "query": f"{gene} {variant} glioma", "maxResults": 10},
)
# Step 2: clinical significance
clin = client.tools.run(
tool_id="clinvar_search",
input={"gene": gene, "variant_name": variant},
)
# Step 3: protein interactions
ppi = client.tools.run(
tool_id="string_db_search",
input={"protein": gene, "species": 9606, "limit": 10, "min_score": 700},
)
# Step 4: stream synthesis
print(f"\n=== {gene} {variant} Evidence Synthesis ===\n")
for chunk in client.query.stream(
prompt=(
f"Synthesize these findings for {gene} {variant}:\n"
f"- {lit['total_hits']} PubMed papers, top title: {lit['articles'][0]['title'][:80]}\n"
f"- ClinVar: {clin['clinical_significance']}, {clin['n_submissions']} submissions\n"
f"- STRING: {len(ppi['interactions'])} interactors, top: {ppi['interactions'][0]['partner']}\n"
"Provide a clinical summary and drug target assessment."
),
workspace_id=ws_id,
):
if chunk.type == "content":
print(chunk.content, end="", flush=True)import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const gene = 'IDH1';
const variant = 'R132H';
// Gather from three databases in parallel
const [lit, clin, ppi] = await Promise.all([
client.tools.run('ncbi_search', {
input: { database: 'pubmed', query: `${gene} ${variant} glioma`, maxResults: 10 },
}),
client.tools.run('clinvar_search', {
input: { gene, variantName: variant },
}),
client.tools.run('string_db_search', {
input: { protein: gene, species: 9606, limit: 10, minScore: 700 },
}),
]);
// Stream synthesis
console.log(`\n=== ${gene} ${variant} Evidence Synthesis ===\n`);
for await (const chunk of client.query.stream({
prompt: `Synthesize findings for ${gene} ${variant}: ${lit.totalHits} PubMed papers; ClinVar: ${clin.clinicalSignificance}; ${ppi.interactions.length} STRING interactors. Provide a clinical summary.`,
workspaceId: workspace.id,
})) {
if (chunk.type === 'content') process.stdout.write(chunk.content ?? '');
}# Step 1: PubMed search
LIT=$(curl -s -X POST https://api.smarts.bio/v1/tools/ncbi_search/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"input": {"database": "pubmed", "query": "IDH1 R132H glioma", "maxResults": 10}}' \
| jq '{total_hits, title: .articles[0].title}')
# Step 2: ClinVar significance
CLIN=$(curl -s -X POST https://api.smarts.bio/v1/tools/clinvar_search/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"input": {"gene": "IDH1", "variant_name": "R132H"}}' \
| jq '.clinical_significance')
# Step 3: Stream evidence synthesis
curl -N -X POST https://api.smarts.bio/v1/query/stream \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d "{\"prompt\": \"Synthesize findings for IDH1 R132H: $LIT; ClinVar: $CLIN. Provide a clinical summary.\", \"workspace_id\": \"ws_abc123\"}"# Step 1: literature smarts tool run ncbi_search \ --param database=pubmed \ --param "query=IDH1 R132H glioma" \ --param maxResults=10 # Step 2: clinical significance smarts tool run clinvar_search \ --param gene=IDH1 \ --param variant_name=R132H # Step 3: protein interactions smarts tool run string_db_search \ --param protein=IDH1 \ --param species=9606 \ --param limit=10 \ --param min_score=700 # Step 4: stream the agent's synthesis into a single report smarts query "Synthesize the PubMed, ClinVar, and STRING findings for IDH1 R132H. \ Provide a clinical summary and drug target assessment."