agentskit.js
Skills

summarizer

Compresses long inputs into short, faithful summaries. Length-aware; preserves citations.

import { createRuntime } from '@agentskit/runtime'
import { summarizer } from '@agentskit/skills'

const runtime = createRuntime({
  adapter,
  skills: [summarizer],
})

await runtime.run('Summarize this 40-page PDF into 10 bullets.')

#When to reach for it

  • Digest long docs (PDFs, meeting transcripts, threads).
  • Rollup: summarize many sources into one.
  • Pair with researcher for sourced summaries.

#Behavior

  • Respects explicit length targets ("10 bullets", "under 100 words").
  • Preserves citations + speaker attribution when present.
  • Declines to summarize when the input contains critical fine-print that must not be collapsed.

#Memory recipe

Use alongside createAutoSummarizingMemory to fold old turns automatically:

import { createAutoSummarizingMemory } from '@agentskit/core/auto-summarize'
import { createInMemoryMemory } from '@agentskit/core'
import { createRuntime } from '@agentskit/runtime'

const summaryRuntime = createRuntime({
  adapter,
  systemPrompt: 'Summarize the following chat transcript in 3 bullet points.',
  maxTokens: 512,
})

const memory = createAutoSummarizingMemory(createInMemoryMemory(), {
  maxTokens: 8_000,
  keepRecent: 10,
  summarizer: async msgs => {
    const src = msgs.map(m => `${m.role}: ${m.content}`).join('\n')
    const result = await summaryRuntime.run(src)
    return {
      id: crypto.randomUUID(),
      role: 'system',
      content: result.content,
      status: 'complete',
      createdAt: new Date(),
    }
  },
})

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page

Ask the docs
Ask anything about AgentsKit. Answers come from the docs corpus and cite their sources.