> For the complete documentation index, see [llms.txt](https://docs.revenium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revenium.io/get-started/quickstart/examples/ai-coding-workflow.md).

# AI Coding Workflow Example

AI coding agents can review pull requests, generate tests, investigate incidents, check releases, and assess dependency risk. Those workflows often look productive in an IDE, but they are hard to evaluate economically unless the engineering work, model usage, tool activity, human review, and outcome are connected.

This example simulates a multi-scenario coding workflow — PR review, regression test generation, incident RCA, release readiness checks, and dependency risk analysis — across multiple agent roles (orchestration, implementation, review, validation). Each job either completes autonomously, escalates to a human, or is canceled, and the deflected engineering value is reported alongside the agent cost.

For the broader outcome-measurement pattern across these examples, see the [overview page](/get-started/quickstart/examples.md).

## What You'll See

When the run completes, these Revenium views populate with the demo data:

* **ROI dashboard** — coding-agent cost vs. deflected engineering value, with net value per job.
* **Deflection Rate** — share of jobs completed autonomously vs. escalated or canceled.
* **Cost Composition** — AI model spend vs. tool spend (repo search, CI compile/test, GitHub review submission) vs. human escalation cost.
* **Scenario Mix** — distribution across PR review, test gen, RCA, release gate, and dep risk.
* **Traces** — multi-step engineering workflows with parent/child relationships, step duration, and outcome linkage.
* **Agent decision costs** — role-level attribution across orchestration, implementation, review, and validation.
* **Performance** — duration outliers and expensive traces, useful for larger batch runs.

## Run It

The example scripts ship in the public SDK repo, not on PyPI. Clone the repo first, then run from inside it:

```bash
git clone https://github.com/revenium/revenium-python-sdk.git
cd revenium-python-sdk
pip install revenium-python-sdk
python examples/agentic_outcomes/coding.py --count 5
```

Set `REVENIUM_API_KEY` (a write-scope key, `rev_sk_…`, generated at [app.revenium.ai → Integrations](https://app.revenium.ai/connections/sdk-setup)) before running. Use `--dry-run` or `--plan` to preview, or `--only-scenario pr-review` to limit to one scenario.

## View The Source

The runnable scenario lives in the public SDK:

* **coding.py** — [examples/agentic\_outcomes/ directory](https://github.com/revenium/revenium-python-sdk/tree/main/examples/agentic_outcomes)
* **Shared runtime (common.py)** — [examples/agentic\_outcomes/ directory](https://github.com/revenium/revenium-python-sdk/tree/main/examples/agentic_outcomes)
* **Examples README** — [github.com/revenium/revenium-python-sdk/blob/main/examples/agentic\_outcomes/README.md](https://github.com/revenium/revenium-python-sdk/blob/main/examples/agentic_outcomes/README.md)

## Customize

The top of `coding.py` exposes the customization points: `SCENARIOS` (workflow mix and per-scenario step sequences), `LLM_STEPS` and `TOOL_STEPS` (reusable step templates), `OUTCOME_WEIGHTS` (autonomous completion / escalation / cancellation rates), and the `ESCALATION_TOOL` cost. Adjust these to match your engineering motion. For the full TUNABLES reference, see the [TUNABLES section of the examples README](https://github.com/revenium/revenium-python-sdk/blob/main/examples/agentic_outcomes/README.md#tunables).

## Why This Matters

AI coding assistants often create value by removing small pieces of engineering work: a review pass, a test draft, an incident summary, or a release check. Those wins are easy to miss if the platform only reports token spend. This example turns that work into measurable unit economics — cost of the agent, value it claims to deflect, and the operational evidence behind the claim.

## Related Views

* [ROI and unit economics](/track-and-control-costs/analyze-roi-and-unit-economics.md)
* [Logs and traces](/optimize-performance/debug-logs-and-traces.md)
* [Latency and performance](/optimize-performance/monitor-latency-and-performance.md)
* [Agent decision costs](/instrument-your-agents/analyze-decision-costs.md)
* [Tool usage](/instrument-your-agents/monitor-agent-tool-usage.md)

## Notes

* Values are illustrative demo values, not engineering benchmark claims.
* Human escalation represents review or takeover cost, not a product recommendation.
* Prompt details in the UI depend on your workspace prompt-capture settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.revenium.io/get-started/quickstart/examples/ai-coding-workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
