> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbindu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 2.1 Text Summarizer

> Creates concise summaries of any input text

Creates concise summaries of any input text.

## Code

Create `text-summarizer.py` with the code below, or save it directly from your editor.

```python theme={null}
from bindu.penguin.bindufy import bindufy
from agno.agent import Agent
from agno.models.openrouter import OpenRouter
from dotenv import load_dotenv
import os

load_dotenv()

agent = Agent(
    instructions="You are a professional summarization assistant. Create clear, concise summaries that capture the main points and essential information from any input text. Aim for 2-3 sentences that preserve the core meaning while being significantly shorter than the original.",
    model=OpenRouter(
        id="openai/gpt-oss-120b",
        api_key=os.getenv("OPENROUTER_API_KEY")
    ),
)

def handler(messages):
    user_input = messages[-1]["content"]
    result = agent.run(input=user_input)
    return result

config = {
    "author": "gaurikasethi88@gmail.com",
    "name": "summarizer_agent",
    "description": "Professional text summarization agent using OpenRouter's openai/gpt-oss-120b model.",
    "deployment": {
        "url": "http://localhost:3773",
        "expose": True,
        "cors_origins": ["http://localhost:5173"]
    },
    "skills": ["skills/text-summarization-skill"],
}

bindufy(config, handler)

#bindufy(config, handler, launch=True)
# This will create a tunnel to your agent and expose it on port 3773
```

## Skill Configuration

Create `skills/text-summarization-skill/skill.yaml`:

```yaml theme={null}
# Text Summarization Skill
# Advanced text summarization with intelligent content condensation

id: text-summarization-skill
name: Text Summarization Skill
version: 1.0.0
author: gaurikasethi88@gmail.com

description: |
  Advanced text summarization agent that creates concise, coherent summaries
  of any input text while preserving key information and context.

  Features:
  - Intelligent content condensation
  - Key point extraction and preservation
  - Context-aware summarization
  - Coherent narrative flow
  - Multi-format text support
  - Rapid processing with OpenRouter integration

  Capabilities:
  - Long-form text summarization
  - Article and document condensation
  - Key point extraction
  - Context preservation
  - Coherent summary generation

  Uses OpenRouter's `openai/gpt-oss-120b` model for high-quality
  summarization with excellent comprehension and generation capabilities.

  Perfect for quickly understanding lengthy documents, articles,
  reports, or any text content that needs to be condensed efficiently.
tags:
  - summarization
  - text-processing
  - content-condensation
  - information-extraction
  - document-analysis
  - reading-assistance
  - productivity
input_modes:
  - application/json
output_modes:
  - application/json
examples:
  - "Summarize this article about climate change"
  - "Create a summary of the quarterly report"
  - "Condense this research paper into key points"
  - "Summarize the meeting transcript"
  - "Extract main points from this email thread"
capabilities_detail:
  text_summarization:
    supported: true
    description: "Creates concise 2-3 sentence summaries of any input text"
  key_point_extraction:
    supported: true
    description: "Identifies and preserves the most important information"
  context_preservation:
    supported: true
    description: "Maintains context and coherence in summaries"
  multi_format_support:
    supported: true
    description: "Handles various text formats and structures"
  rapid_processing:
    supported: true
    description: "Fast summarization using OpenRouter's efficient model"
```

## How It Works

**Summarization Instructions**

* Clear directive: "Create clear, concise summaries"
* Target length: 2-3 sentences
* Preserves core meaning while reducing length

**Handler**

* Extracts user input: `messages[-1]["content"]`
* Passes to agent for summarization
* Returns condensed version

**Model**

* `openai/gpt-oss-120b`: Advanced text understanding
* Via OpenRouter API
* Optimized for text transformation tasks

**Skills**

* `text-summarization-skill`: Defines summarization capabilities
* Enables skill-based discovery

## Dependencies

```bash theme={null}
uv init
uv add bindu agno python-dotenv
```

## Environment Setup

Create `.env` file:

```bash theme={null}
OPENROUTER_API_KEY=your_openrouter_api_key_here
```

## Run

```bash theme={null}
uv run text-summarizer.py
```

Try: "Summarize this text about climate change and its effects on the environment"

## Example API Calls

<AccordionGroup>
  <Accordion title="Message Send Request">
    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "method": "message/send",
      "params": {
        "message": {
          "role": "user",
          "kind": "message",
          "messageId": "9f11c870-5616-49ad-b187-d93cbb100001",
          "contextId": "9f11c870-5616-49ad-b187-d93cbb100002",
          "taskId": "9f11c870-5616-49ad-b187-d93cbb100003",
          "parts": [
            {
              "kind": "text",
              "text": "Summarize this text about climate change and its effects on the environment"
            }
          ]
        },
         "skillId": "text-summarization-skill",
        "configuration": {
          "acceptedOutputModes": ["application/json"]
        }
      },
      "id": "9f11c870-5616-49ad-b187-d93cbb100003"
    }
    ```
  </Accordion>

  <Accordion title="Task get Request">
    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "method": "tasks/get",
      "params": {
        "taskId": "9f11c870-5616-49ad-b187-d93cbb100003"
      },
      "id": "9f11c870-5616-49ad-b187-d93cbb100004"
    }
    ```
  </Accordion>
</AccordionGroup>

## Frontend Setup

```bash theme={null}
# Clone the Bindu repository
git clone https://github.com/GetBindu/Bindu

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start frontend development server
npm run dev
```

Open [http://localhost:5173](http://localhost:5173) and try to chat with the text summarizer
