diff --git a/apps/web/src/app/docs/developers/guide/page.tsx b/apps/web/src/app/docs/developers/guide/page.tsx new file mode 100644 index 0000000..c0d4454 --- /dev/null +++ b/apps/web/src/app/docs/developers/guide/page.tsx @@ -0,0 +1,690 @@ +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@tpmjs/ui/Card/Card'; +import { CodeBlock } from '@tpmjs/ui/CodeBlock/CodeBlock'; +import type { Metadata } from 'next'; +import Link from 'next/link'; + +export const metadata: Metadata = { + title: 'Developers Guide | TPMJS Docs', + description: + 'Understand Scenarios for developers - AI-powered testing, evaluation, and continuous integration for tool collections', +}; + +export default function DevelopersGuidePage(): React.ReactElement { + return ( +
+ Scenarios are TPMJS's AI-powered testing and evaluation system for tool collections. + They provide automated testing, quality tracking, and regression prevention for your + tools. +
++ A Scenario is a test case that simulates how a real user would interact with your tool + collection. Unlike traditional unit tests that verify individual functions, scenarios + exercise your tools end-to-end with realistic prompts and assertions. +
+ ++ Think of scenarios as integration tests with AI intelligenceโinstead of hard-coded + assertions, scenarios use natural language evaluation to verify your tools work as + intended. +
++ Run scenarios automatically on every code change to catch regressions early. +
++ Use LLM evaluation to verify your tools actually solve real problems, not just pass + code tests. +
++ Track quality scores over time to identify reliable scenarios and areas for + improvement. +
++ Integrate seamlessly into your pipeline with JSON output and exit codes. +
++ Scenarios are defined as test cases with a prompt, expected outputs, and optional + assertions. They can be created manually or AI-generated. +
++ When a scenario runs, an ephemeral AI agent is created with your tool collection. The + agent executes the scenario prompt using only the tools in that collectionโno external + access, no additional context. +
++ After execution, a powerful LLM evaluates the results. This isn't just checking + for errorsโit uses natural language understanding to verify the task was completed + correctly. +
++ Quality scores (0-100%) track scenario reliability over time using a streak-based + system: +
++ Example: A scenario that passes 5 times consecutively earns 25% bonus + (50% + 5ร5) for a total score of ~75%. High-quality scenarios (75%+) are featured on + the TPMJS homepage showcase. +
++ Every scenario execution captures the full conversation history between the agent, + your tools, and any outputs. This enables: +
++ Automate scenario testing in your deployment pipeline to catch regressions before they + reach production. +
++ Benefits: Block deploys on failures, generate test reports, and track + quality metrics over time. +
++ Test scenarios locally during development to verify tool behavior without consuming + quota. +
++ Benefits: Fast feedback loop, no quota consumption, and detailed + execution traces for debugging. +
++ Use scenario results to build dashboards showing tool reliability, success rates, and + performance trends. +
++ Benefits: Track improvements over time, identify flaky tools, and + demonstrate reliability to users. +
++ Ensure your tools work correctly with scenarios before publishing them. High-quality + scenarios increase tool visibility on the TPMJS homepage. +
+| Feature | +Unit Tests | ++ Integration Tests + | +Scenarios | +
|---|---|---|---|
| + Execution Model + | ++ Code runs individual functions + | ++ Full system with external services + | +AI agent + your tools | +
| + Assertions + | ++ Hard-coded conditions (a === b) + | ++ Integration with test database + | +LLM natural language evaluation | +
| + Coverage + | ++ Function-level code coverage + | ++ End-to-end workflow coverage + | +Realistic user prompt coverage | +
| + Maintenance + | ++ Brittle with implementation changes + | +Better with refactoring | +Self-healing with AI prompts | +
| + Debugging + | +Stack traces, breakpoints | ++ Network logs, service logs + | ++ Full conversation history with tool I/O + | +
| + Best For + | ++ Pure algorithms, mathematical functions + | ++ Business logic, workflows, APIs + | ++ AI tools, LLM interaction, realistic prompts + | +
+ Scenarios that analyze their own failures and automatically improve their prompts. + Failed scenarios can generate fixes or suggest alternative approaches. +
++ Each scenario run contributes to quality metrics, creating a feedback loop that + continuously improves tool quality and scenario design over time. +
++ Automate scenario testing in your deployment pipeline to catch regressions before they + reach production. +
++ Benefits: Block deploys on failures, generate test reports, and track + quality metrics over time. +
++ Beyond simple pass/fail, future scenarios will measure token efficiency, response + quality, semantic correctness, and hallucination rates. +
++ Share high-quality scenarios across organizations, enabling collaborative testing and + faster scenario coverage for popular tools. +
++ Scenarios will become the de facto standard for tool quality assurance on TPMJS. + Before users install a tool, they'll see its scenario history, quality scores, + and real-world performance metrics. +
++ Get a TPMJS API key from your{' '} + + dashboard settings + +
++ Add tools to a collection if you don't have one yet. +
++ REST API endpoints for programmatic scenario management +
++ Complete CLI commands for scenario generation and execution +
++ Learn how scenarios use agents internally for execution +
++ Create and manage collections with your tools +
+