agent.pyproductivityLangchainv1.0.0

LangChain: Meeting Summarizer

Summarizes meeting transcripts into key points, decisions, and action items.

Setup time: ~10 min
Model: GPT-4o
Cost: ~$0.10/day
Last updated: Mar 16, 2026
byRunbooks Communitycontributor

Template

agent.py
# Install: pip install langchain langchain-openai

from langchain_openai import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.chains.summarize import load_summarize_chain
from langchain_core.documents import Document
import sys
import os

# --- Config ---
llm = ChatOpenAI(model="gpt-4o", temperature=0)

# --- Summarization prompt ---
map_prompt = ChatPromptTemplate.from_messages([
    ("system", "You are an expert meeting note-taker."),
    ("human", """Summarize this section of a meeting transcript. Extract:
- Key discussion points
- Decisions made
- Action items (who, what, when)

Transcript section:
{text}

Summary:"""),
])

combine_prompt = ChatPromptTemplate.from_messages([
    ("system", "You are an expert meeting note-taker."),
    ("human", """Combine these meeting summaries into a final structured summary.

Format:
## Meeting Summary
### Key Discussion Points
- ...
### Decisions Made
- ...
### Action Items
- [ ] @person: task (due date)
### Next Steps
- ...

Summaries to combine:
{text}

Final Summary:"""),
])

def summarize_meeting(transcript_path: str) -> str:
    with open(transcript_path, "r") as f:
        transcript = f.read()

    splitter = RecursiveCharacterTextSplitter(chunk_size=3000, chunk_overlap=200)
    docs = [Document(page_content=chunk) for chunk in splitter.split_text(transcript)]

    chain = load_summarize_chain(
        llm,
        chain_type="map_reduce",
        map_prompt=map_prompt,
        combine_prompt=combine_prompt,
    )
    result = chain.invoke(docs)
    return result["output_text"]

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python agent.py <transcript.txt>")
        sys.exit(1)
    summary = summarize_meeting(sys.argv[1])
    print(summary)

Setup

  1. 1

    Copy the agent.py content above.

  2. 2

    Create a Python virtual environment and install dependencies.

  3. 3

    Set your OPENAI_API_KEY environment variable.

  4. 4

    Run: python agent.py

Run with LangChain

This is a Python script using LangChain. Set up a virtual environment and install dependencies.

# 1. Create a virtual environment
python -m venv venv && source venv/bin/activate

# 2. Install dependencies
pip install langchain langchain-openai langchain-community chromadb

# 3. Set your API key
export OPENAI_API_KEY="sk-..."

# 4. Save the agent.py from above and run it
python agent.py

Version History

v1.0.0Initial releaseMar 16, 2026

Framework

Langchain

Requirements

Python 3.10+
OpenAI API key

Estimated cost

~$0.10/day

on GPT-4o model

File type

agent.py

Version

v1.0.0

Updated Mar 16, 2026

Contributor

Runbooks Community

Community submission

You might also like