Builders · library
Build your own sustainability tool on the report-analyst library
Building your own sustainability tool? Use Open Sustainability Analyst as a library: keep your interface and workflow, get grounded report answers (evidence + gaps), and ship faster than rebuilding retrieval and prompting yourself.
Product shape
Two products, one engine
Open Sustainability Analyst ships a Streamlit analyst UI — and the same engine as a library so you can keep your own screens, workflows, and brand.
-
Standalone analyst tool
Deploy the Streamlit app when your team wants report analysis out of the box. Guides: Render · Streamlit Cloud. -
Library inside your product
Importreport_analyst.core.library(or call the REST API) when procurement, risk, or research needs a custom interface but still wants answers grounded in report evidence — not uncited chat. -
Same question sets either way
Reuse built-in frameworks (TCFD, ESRS-oriented sets, …) or ship a tiny YAML for one topic. Customize YAML: framework guide.
Python
Call the library
Three calls cover the host-app pattern: resolve questions → analyze a PDF → build a brief from grounded rows.
-
analyze_report → GroundedAnswer rows
Each row carriesanswer,score,evidence,gaps, andsources— the same evidence contract the Streamlit UI shows.from report_analyst.core.library import analyze_report, build_topic_brief answers = await analyze_report( "supplier-report.pdf", "examples/grounded_topic_brief/questions/water_risk_questions.yaml", ) brief = build_topic_brief(answers, topic="Supplier water-risk brief") # brief["findings"] → answer + evidence + gaps for your UISource: report_analyst/core/library.py. Sync scripts can use
analyze_report_sync. -
Pass a set id or your own YAML
Use a built-in id ("tcfd") or a path to*_questions.yaml. The water-risk demo ships a three-question supplier screen in the example folder. -
Prefer HTTP? Use the API module
report_analyst_api/wraps the same analyzer over REST. In-process import is best when the host app already runs Python; the API fits microservices.
Demo app
Custom UI: one report, one topic, then use the data
The grounded topic-brief example is a small custom host app: analyze one PDF for water risk, show a readable brief, and expose grounded JSON for the rest of your product.
-
What the demo does
- Upload one sustainability report in a custom page.
- Run the water-risk question set via the library.
- Show evidence-backed answers.
- Build a structured brief (
GET /brief) your product can store or render.
-
Run it locally
Clone climateandtech/report-analyst, install core deps, then:pip install -r requirements.txt fastapi uvicorn python-multipart export OPENAI_API_KEY=… # or GOOGLE_API_KEY cd examples/grounded_topic_brief python app.py # open http://127.0.0.1:8765Full notes: examples/grounded_topic_brief.
-
Swap the topic
Replacequestions/water_risk_questions.yamlwith your own ids/texts/guidelines (net-zero, human rights, biodiversity, …). Keep the host UI; change only the question set.
FAQ
- When should I use the ready-made app vs the library?
- Use the ready-made OSA app when analysts want frameworks out of the box. Use the library when you are building your product UI and want OSA’s grounded analysis underneath — usually the faster path than starting from a blank LLM stack.
- Do I still need an LLM API key?
- Yes — same as the Streamlit app. Set
OPENAI_API_KEYorGOOGLE_API_KEYin the host process environment. - Can I use only the REST API?
- Yes. Deploy
report_analyst_api/and keep a thin frontend. The library module is for in-process Python hosts that want typed grounded rows without an HTTP hop.
Need a walkthrough for your stack? Book a short setup chat.