Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenEntwickler: Claude Code macht Job seelenlos(23.09.2026 um 10:06 Uhr)
IT Security NachrichtenBW/4HANA oder Business Data Cloud: Migration als Grundsatzentscheidung(23.09.2026 um 10:32 Uhr)
IT Security NachrichtenZukunftssichere Unternehmenssteuerung im Mittelstand(23.09.2026 um 10:50 Uhr)
IT Security NachrichtenWhy security belongs in the network(23.09.2026 um 10:00 Uhr)
IT Security NachrichtenNeue Cybersecurity-Pflichten für den Maschinenbau(23.09.2026 um 11:00 Uhr)
IT Security NachrichtenOpus 5.5: Anthropics neues KI-Modell - mehr Leistung, geringere Kosten(23.09.2026 um 09:50 Uhr)
IT Security NachrichtenFBI gehackt: Täter erbeuten angeblich die Daten aller Mitarbeiter(23.09.2026 um 10:30 Uhr)
IT Security NachrichtenTiefpreis-Tage: 13 Deals bei Media Markt & Saturn, die sich lohnen(23.09.2026 um 10:51 Uhr)
IT Security NachrichtenPatchday: Adobe Connect ist unter Android, macOS und Windows verwundbar(23.09.2026 um 10:45 Uhr)
IT Security DownloadsFoxit PDF Reader Download - PDF-Dateien anzeigen(23.09.2026 um 09:39 Uhr)
IT Security NachrichtenEntwickler: Claude Code macht Job seelenlos(23.09.2026 um 10:06 Uhr)
IT Security NachrichtenBW/4HANA oder Business Data Cloud: Migration als Grundsatzentscheidung(23.09.2026 um 10:32 Uhr)
IT Security NachrichtenZukunftssichere Unternehmenssteuerung im Mittelstand(23.09.2026 um 10:50 Uhr)
IT Security NachrichtenWhy security belongs in the network(23.09.2026 um 10:00 Uhr)
IT Security NachrichtenNeue Cybersecurity-Pflichten für den Maschinenbau(23.09.2026 um 11:00 Uhr)
IT Security NachrichtenOpus 5.5: Anthropics neues KI-Modell - mehr Leistung, geringere Kosten(23.09.2026 um 09:50 Uhr)
IT Security NachrichtenFBI gehackt: Täter erbeuten angeblich die Daten aller Mitarbeiter(23.09.2026 um 10:30 Uhr)
IT Security NachrichtenTiefpreis-Tage: 13 Deals bei Media Markt & Saturn, die sich lohnen(23.09.2026 um 10:51 Uhr)
IT Security NachrichtenPatchday: Adobe Connect ist unter Android, macOS und Windows verwundbar(23.09.2026 um 10:45 Uhr)
IT Security DownloadsFoxit PDF Reader Download - PDF-Dateien anzeigen(23.09.2026 um 09:39 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to Build an agent using coral

How I Built an AI Agent That Queries GitHub, Calendar, and Sleep Data With One SQL Interface A practical guide to Coral — the local-first SQL runtime that gives your agents a single query layer over any API I spent the better part of …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




How I Built an AI Agent That Queries GitHub, Calendar, and Sleep Data With One SQL Interface



A practical guide to Coral — the local-first SQL runtime that gives your agents a single query layer over any API






I spent the better part of a week building an agent that could answer questions like "why am I not productive lately?" The idea was simple: pull data from GitHub, Google Calendar, and sleep tracking, cross-reference everything, and get an AI answer.



The hard part turned out to be the data plumbing. Every source has its own auth, its own pagination, its own quirks. By the time I had GitHub and Calendar talking to the same script, I had written more glue code than actual agent logic.



Then I found Coral.



This post walks through what Coral is, why it matters for agent development, and how to build a working AI agent with it from scratch.









The problem with how agents access data today



Most agent workflows look like this:




Agent → Tool A → API A
Agent → Tool B → API B
Agent → Tool C → API C






Each tool call is isolated. The agent has to reason about three separate schemas, handle three different auth flows, and then try to mentally join the results. This creates:





  • Too many LLM round-trips — each tool call is its own context window exchange


  • Repeated glue code — pagination, retry logic, rate limiting, per source


  • Poor cross-source reasoning — the LLM sees results one at a time, not as a unified dataset


  • High token costs — raw API responses are verbose JSON, not trimmed result sets



The benchmark from the Coral team actually quantified this: across 82 real-world tasks, Claude was 20% more accurate and 2x more cost efficient using Coral versus direct provider MCPs. For complex multi-hop queries (the kind coding agents actually do), accuracy jumped 31% and cost dropped 3.4x.



The reason is architectural. Coral gives agents one SQL interface over everything.









What is Coral?



Coral is a local-first SQL runtime that sits between your agent and your data sources. You write SQL, Coral translates it into API calls (handling auth, pagination, and retries), and returns clean tabular rows.




Your Agent → SQL → Coral → GitHub API
→ Google Calendar API
→ Local JSONL files

One result set






The key properties:



Local-first. Everything runs on your machine. Credentials are stored locally and never leave. Coral is a read layer — it makes API calls on your behalf but doesn't send your data anywhere.



Sources as SQL schemas. When you connect GitHub, it appears as a github schema. You query github.commits, github.issues, github.pulls just like database tables. Same pattern for every source.



Joins across sources. Because every source looks like a SQL table, you can JOIN across them. Coral executes the join locally after fetching each side. That single query replaces three separate tool calls and the LLM reasoning needed to combine them.



MCP server built-in. Coral ships with an MCP server so you can wire it directly into Claude Code, Cursor, or any MCP-compatible agent with one command.









Installing Coral



macOS:




brew install withcoral/tap/coral






Linux:




curl -fsSL https://withcoral.com/install.sh | sh






Windows (10/11 x86_64):

Download coral-x86_64-pc-windows-msvc.zip from the latest GitHub release, extract it, and add coral.exe to your PATH.



Verify the install:




coral --version












Connecting your first source



Coral ships with bundled sources for GitHub, Google Calendar, Linear, Sentry, Datadog, Stripe, Slack, and more. See everything available:




coral source discover






Let's connect GitHub. You'll need a Personal Access Token with repo and read:user scopes:




coral source add --interactive github
# Coral will prompt: Enter your GitHub PAT






Once connected, verify it works:




coral sql "SELECT schema_name, table_name FROM coral.tables WHERE schema_name = 'github'"






You should see rows for github.commits, github.issues, github.pulls, github.user, and others.



Try a real query:




coral sql "
SELECT CAST(commit__author__date AS DATE) AS date, COUNT(*) AS commits
FROM github.commits
WHERE owner = 'your-username'
AND commit__author__date >= NOW() - INTERVAL '7 days'
GROUP BY 1
ORDER BY 1 DESC
"








Coral flattens nested JSON with __ as the separator. So commit.author.date in the GitHub API response becomes commit__author__date in your SQL. Run SELECT column_name FROM coral.columns WHERE schema_name = 'github' AND table_name = 'commits' to inspect the exact column names for any table.










Building the agent



We'll build a Node.js agent that answers natural language questions about your GitHub activity. Ask it "what have I been shipping this week?" and it queries your real commit data and returns an AI-generated summary.






Project setup






mkdir my-coral-agent && cd my-coral-agent
npm init -y
npm install @google/genai dotenv






Create a .env file:




GEMINI_API_KEY=your_key_here
GITHUB_USERNAME=your_github_username









The agent — agent.ts



The full agent is around 80 lines. Here's how it works:



Step 1: Query Coral for real data




import { execFileSync } from 'child_process'

function coralQuery<T>(sql: string): T[] {
const stdout = execFileSync('coral', ['sql', '--format', 'json', sql.trim()], {
encoding: 'utf-8',
timeout: 30_000,
stdio: ['pipe', 'pipe', 'ignore'], // suppress Coral's stderr
})
return JSON.parse(stdout) as T[]
}






We call Coral's CLI and ask for JSON output. execFileSync blocks until Coral finishes — Coral handles all the GitHub API calls, pagination, and auth internally.



Step 2: Gather the data




function getGithubActivity(username: string, days: number) {
// Commits per day
const commits = coralQuery<{ date: string; repos: string; count: number }>(`
SELECT
CAST(commit__author__date AS DATE) AS date,
ARRAY_AGG(DISTINCT repo) AS repos,
COUNT(*) AS count
FROM github.commits
WHERE owner = '
${username}'
AND commit__author__date >= NOW() - INTERVAL '
${days} days'
GROUP BY 1
ORDER BY 1 DESC
`
)

// Open PRs
const prs = coralQuery<{ title: string; state: string; created_at: string }>(`
SELECT title, state, created_at
FROM github.pulls
WHERE owner = '
${username}'
AND created_at >= NOW() - INTERVAL '
${days} days'
ORDER BY created_at DESC
LIMIT 20
`
)

return { commits, prs }
}






Step 3: Ask Gemini




import { GoogleGenAI } from '@google/genai'

async function ask(question: string, data: object): Promise<string> {
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! })

const response = await ai.models.generateContent({
model: 'gemini-2.5-flash',
config: {
systemInstruction: `You are a developer productivity assistant.
You have access to real GitHub data. Be direct and specific.
Reference actual repos and dates from the data.`
,
},
contents: `
Developer question: "
${question}"

GitHub data (last 7 days):
${JSON.stringify(data, null, 2)}

Answer the question using this data.
`
,
})

return response.text ?? ''
}






Step 4: Wire it together




import dotenv from 'dotenv'
dotenv.config()

async function main() {
const question = process.argv.slice(2).join(' ')
if (!question) {
console.log('Usage: npx tsx agent.ts "what have I been working on?"')
process.exit(1)
}

const username = process.env.GITHUB_USERNAME!
console.log('Querying GitHub via Coral...')

let data: object
try {
data = getGithubActivity(username, 7)
} catch (err) {
console.error('Coral query failed:', err)
process.exit(1)
}

console.log('Analyzing...\n')
const answer = await ask(question, data)
console.log(answer)
}

main()









Run it






npx tsx agent.ts "what have I been shipping this week?"
npx tsx agent.ts "which repo am I spending the most time on?"
npx tsx agent.ts "have I been less active than usual?"






The agent queries your live GitHub data, hands it to Gemini, and returns a natural language answer grounded in actual commit history.









Going further: cross-source queries



The real power of Coral is joins across sources. Add a second source:




coral source add --interactive google_calendar






Now you can ask questions that span both:




-- Commits on days with heavy meeting load
SELECT
CAST(c.commit__author__date AS DATE) AS date,
COUNT(DISTINCT c.sha) AS commits,
COUNT(DISTINCT e.id) AS meetings
FROM github.commits c
LEFT JOIN google_calendar.events e
ON CAST(c.commit__author__date AS DATE) = CAST(e.start_date_time AS DATE)
WHERE c.owner = 'your-username'
AND c.commit__author__date >= NOW() - INTERVAL '30 days'
GROUP BY 1
ORDER BY 1 DESC






This is a query that would normally require two separate API calls, result storage, and manual joining in your agent code. With Coral, it's one SQL statement.









Using Coral over MCP



If you're using Claude Code, Cursor, or any MCP-compatible agent, you can expose Coral as an MCP server — no custom code required:




# Claude Code
claude mcp add --scope user coral -- coral mcp-stdio






After this, your agent can query all connected sources directly using natural language. Ask it to "show me open GitHub issues assigned to me" and it will write the SQL and run it through Coral automatically.



You can also install Coral's skills to teach your agent the discovery-first workflow:




npx skills add withcoral/skills






This gives your agent knowledge of coral.tables, coral.columns, and the metadata tables it needs to explore schemas before writing queries.









What I actually built



The agent I described at the start — the one that cross-references GitHub, Calendar, and sleep data to answer "why am I not productive?" — uses exactly this pattern.



The behavioral metrics engine computes:




  • Sleep decline vs baseline

  • Late-night coding session frequency

  • Meeting load increase as a percentage over your own baseline

  • Context switching (repos per day, live from GitHub commits)

  • Interruption count trends



All of it feeds into Gemini as a structured prompt. The result looks like this in the terminal:




  BURNOUT RISK  ─────────────────────────────────

▘▀▀▀▀▀▀▀▀▀▀▀▝
▌ 75/100 ▐
▌ HIGH ▐
▗▄▄▄███████▄▖

────────────────────────────────────────────────

TL;DR
────────────────────────────────────────
Sleep dropped 38% while meetings tripled — you're
compensating with late-night coding and it's not working.

KEY FINDINGS
────────────────────────────────────────
◆ Average sleep fell from 8.1h to 5.0h over 30 days
◆ Meetings increased from 1.5/day to 5.2/day (+180%)
◆ 6 late-night coding sessions in the last 7 days vs 0 in baseline
◆ Context switching across 4 repos/day vs 1 repo/day baseline
◆ Productivity score: 36/100 (down from 79 baseline)






The full source is on GitHub. The key file is src/coral/sources/github.ts which shows exactly how to wrap Coral queries in a TypeScript function and handle the column naming conventions.









Summary



Coral is one of those tools that removes a whole category of boilerplate. Instead of writing per-source auth, pagination, and retry logic, you write SQL. Instead of your agent reasoning about three separate tool outputs, it reasons about one result set.



The setup is:




# 1. Install
brew install withcoral/tap/coral # or curl on Linux, zip on Windows

# 2. Connect a source
coral source add --interactive github

# 3. Query
coral sql "SELECT repo, COUNT(*) FROM github.commits WHERE owner = 'you' GROUP BY 1"

# 4. Use in your agent
execFileSync('coral', ['sql', '--format', 'json', query])






That's really it. The complexity sits inside Coral, and your agent code stays clean.






If you build something with Coral, I'd like to see it. The xetroc source is at github.com/TejaswaHinduja/xetroc if you want a reference implementation to work from.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Build an agent using coral

Thematisch verwandte Begriffe: Build, agent, using, coral · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick