import { T2000 } from '@t2000/sdk';
const agent = await T2000.create();
const question = 'Leading approaches to stablecoin yield on Sui, and how they differ';
const [sources, grounded] = await Promise.all([
agent.pay({
url: 'https://mpp.t2000.ai/exa/v1/search',
method: 'POST',
body: JSON.stringify({ query: question, numResults: 5, contents: { text: true } }),
}),
agent.pay({
url: 'https://mpp.t2000.ai/perplexity/v1/chat/completions',
method: 'POST',
body: JSON.stringify({
model: 'sonar',
messages: [{ role: 'user', content: `${question}. Answer with inline citations.` }],
}),
}),
]);
const brief = await agent.pay({
url: 'https://mpp.t2000.ai/anthropic/v1/messages',
method: 'POST',
headers: { 'anthropic-version': '2023-06-01' },
body: JSON.stringify({
model: 'claude-sonnet-4-5',
max_tokens: 700,
messages: [{
role: 'user',
content:
`Write a 250-word answer to: "${question}". Keep every claim tied to a source URL.\n\n` +
`SEMANTIC SOURCES: ${JSON.stringify(sources.body)}\n\nGROUNDED ANSWER: ${JSON.stringify(grounded.body)}`,
}],
}),
});
console.log((brief.body as { content: { text: string }[] }).content[0].text);