Skip to main content

Evidence API Guide

The Evidence API provides endpoints for collecting, storing, and retrieving evidence to support AI agent debates with factual information.

Overview​

Evidence in Aragora consists of:

  • Citations: Links to external sources
  • Quotes: Verbatim text from sources
  • Data Points: Structured facts and statistics
  • Quality Scores: Credibility ratings for each piece of evidence

API Endpoints​

EndpointMethodDescriptionRate Limit
/api/evidenceGETList all evidence60/min
/api/evidence/:idGETGet evidence by ID60/min
/api/evidence/searchPOSTFull-text search60/min
/api/evidence/collectPOSTCollect new evidence10/min
/api/evidence/debate/:idGETGet debate evidence60/min
/api/evidence/debate/:idPOSTAssociate evidence10/min
/api/evidence/statisticsGETStore statistics60/min
/api/evidence/:idDELETEDelete evidence10/min

Usage Examples​

List Evidence​

# Basic listing with pagination
curl "http://localhost:8080/api/evidence?limit=20&offset=0"

# Filter by source type
curl "http://localhost:8080/api/evidence?source_type=academic"

# Filter by minimum quality score
curl "http://localhost:8080/api/evidence?min_quality=0.7"

Response:

{
"evidence": [
{
"id": "ev-12345",
"title": "Climate Change Impact Study",
"source": "https://example.com/study.pdf",
"source_type": "academic",
"content": "Global temperatures have risen...",
"quality_score": 0.92,
"created_at": "2024-01-15T10:30:00Z",
"metadata": {
"author": "Dr. Smith",
"publication": "Nature",
"year": 2024
}
}
],
"total": 150,
"limit": 20,
"offset": 0
}

Search Evidence​

curl -X POST "http://localhost:8080/api/evidence/search" \
-H "Content-Type: application/json" \
-d '{
"query": "renewable energy efficiency",
"source_types": ["academic", "government"],
"min_quality": 0.6,
"limit": 10
}'

Response:

{
"results": [
{
"id": "ev-67890",
"title": "Solar Panel Efficiency Report",
"relevance_score": 0.95,
"quality_score": 0.88,
"snippet": "...renewable energy sources have shown 40% efficiency improvements..."
}
],
"query": "renewable energy efficiency",
"total_matches": 42
}

Collect Evidence​

Automatically gather evidence for a topic:

curl -X POST "http://localhost:8080/api/evidence/collect" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"topic": "Impact of AI on job market",
"sources": ["academic", "news", "government"],
"max_items": 10,
"quality_threshold": 0.7
}'

Response:

{
"collected": 8,
"failed": 2,
"evidence_ids": ["ev-001", "ev-002", "ev-003", "..."],
"quality_summary": {
"average_score": 0.82,
"high_quality_count": 6,
"sources_used": ["arxiv", "bls.gov", "reuters"]
}
}

Associate Evidence with Debate​

curl -X POST "http://localhost:8080/api/evidence/debate/debate-123" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"evidence_ids": ["ev-001", "ev-002"],
"relevance_notes": "Supporting arguments for pro side"
}'

Get Debate Evidence​

curl "http://localhost:8080/api/evidence/debate/debate-123"

Response:

{
"debate_id": "debate-123",
"evidence": [
{
"id": "ev-001",
"title": "Economic Impact Study",
"used_by_agents": ["claude-opus", "gpt-4"],
"citation_count": 3,
"quality_score": 0.89
}
],
"total": 5
}

Get Statistics​

curl "http://localhost:8080/api/evidence/statistics"

Response:

{
"total_evidence": 1250,
"by_source_type": {
"academic": 450,
"news": 380,
"government": 220,
"other": 200
},
"average_quality": 0.76,
"storage_size_mb": 45.2,
"oldest_evidence": "2023-06-15T00:00:00Z",
"newest_evidence": "2024-01-15T12:00:00Z"
}

TypeScript SDK Usage​

import { createClient } from '@aragora/sdk';

const client = createClient({
baseUrl: 'http://localhost:8080',
apiKey: 'your-token',
});

// Get evidence for a debate
const evidence = await client.debates.getEvidence('debate-123');

// Search knowledge/evidence
const results = await client.knowledge.search('machine learning healthcare', {
limit: 10,
});

// Add evidence to a debate
const collected = await client.debates.addEvidence(
'debate-123',
'New evidence text',
'research-paper'
);

Quality Scoring​

Evidence quality is scored based on:

FactorWeightDescription
Source Credibility30%Academic, government sources score higher
Recency20%More recent evidence preferred
Citation Count20%Well-cited sources score higher
Content Relevance20%Match to query/topic
Verification Status10%Fact-checked content bonus

Quality score ranges:

  • 0.8-1.0: High quality, authoritative sources
  • 0.6-0.8: Good quality, reliable sources
  • 0.4-0.6: Moderate quality, verify claims
  • 0.0-0.4: Low quality, use with caution

Source Types​

TypeDescriptionTypical Quality
academicPeer-reviewed papers, journalsHigh
governmentOfficial reports, statisticsHigh
newsMajor news outletsMedium-High
industryCompany reports, whitepapersMedium
socialSocial media, forumsLow-Medium
otherMiscellaneous sourcesVaries

Error Handling​

Common error responses:

// Rate limited
{
"error": "Rate limit exceeded",
"retry_after": 60
}

// Not found
{
"error": "Evidence not found",
"evidence_id": "ev-invalid"
}

// Collection failed
{
"error": "Evidence collection failed",
"reason": "External API unavailable",
"partial_results": ["ev-001"]
}