# Examples

Each example is a `function.json` for `jinn publish`. Replace the provider with yours.

## Answer support tickets

A help desk's webhook starts a run per ticket. The function looks the customer up with a [custom tool](/functions#custom-tools) and returns a reply and the actions to take. The help desk posts the reply; your service makes the refunds.

```json
{
  "name": "support-triage",
  "base": "debian-12-20260801-72c15f01",
  "setup": [],
  "provider": "prv_8c1f04d2a7b93e650f1a2c47@latest",
  "system_prompt": "You answer billing tickets. Read /workspace/in/ticket.json. Look the customer up. Write the reply to /workspace/out/reply.md and the refunds to make to /workspace/out/actions.json as [{\"charge\": \"…\", \"amount\": 0}]. Then call submit_result.",
  "tools": ["bash", "read", "write"],
  "custom_tools": [{
    "name": "lookup_customer",
    "description": "Find a customer and their recent charges by email.",
    "parameters": { "type": "object", "properties": { "email": { "type": "string" } }, "required": ["email"] },
    "url": "https://support.example/tools/customer",
    "secret": "sk_tool_4f9a…",
    "timeout_seconds": 30
  }],
  "input_manifest": [{ "path": "ticket.json", "description": "The ticket", "max_bytes": 1000000 }],
  "output_manifest": [
    { "path": "reply.md", "description": "The reply to send", "max_bytes": 100000 },
    { "path": "actions.json", "description": "Refunds to make", "max_bytes": 100000 }
  ],
  "environment": [],
  "size": "s",
  "timeout_minutes": 15
}
```

## Review a pull request

A CI job sends the repository and the diff as the input folder. The agent runs the tests and writes a review.

```json
{
  "name": "pr-review",
  "base": "debian-12-20260801-72c15f01",
  "setup": ["apt-get update", "apt-get install -y --no-install-recommends golang-go"],
  "provider": "prv_8c1f04d2a7b93e650f1a2c47@latest",
  "system_prompt": "The repository is in /workspace/in/repo and the change in /workspace/in/change.diff. Apply the change, run the tests, and review it. Write the review to /workspace/out/review.md and line comments to /workspace/out/comments.json. Then call submit_result.",
  "tools": ["bash", "read", "write", "edit"],
  "custom_tools": [],
  "input_manifest": [
    { "path": "repo/", "description": "The repository at the base commit", "max_bytes": 500000000 },
    { "path": "change.diff", "description": "The change", "max_bytes": 5000000 }
  ],
  "output_manifest": [
    { "path": "review.md", "description": "The review", "max_bytes": 200000 },
    { "path": "comments.json", "description": "Line comments", "max_bytes": 200000 }
  ],
  "environment": [],
  "size": "m",
  "timeout_minutes": 30
}
```

## A weekly report from data

A scheduler starts a run every Monday with last week's export. The agent builds charts and a short report.

```json
{
  "name": "monday-report",
  "base": "debian-12-20260801-72c15f01",
  "setup": ["apt-get update", "apt-get install -y --no-install-recommends python3-pandas python3-matplotlib"],
  "provider": "prv_8c1f04d2a7b93e650f1a2c47@latest",
  "system_prompt": "Read the CSV files in /workspace/in. Compare this week with last week. Write /workspace/out/report.md with the three changes that matter most, and save a chart for each in /workspace/out/charts/. Then call submit_result.",
  "tools": ["bash", "read", "write"],
  "custom_tools": [],
  "input_manifest": [],
  "output_manifest": [
    { "path": "report.md", "description": "The report", "max_bytes": 200000 },
    { "path": "charts/", "description": "One PNG per change", "max_bytes": 20000000 }
  ],
  "environment": [],
  "size": "s",
  "timeout_minutes": 20
}
```

## Check a web page

The `screenshot` tool and Chromium let an agent look at what it builds or tests.

```json
{
  "name": "page-check",
  "base": "debian-12-20260801-72c15f01",
  "setup": [],
  "provider": "prv_8c1f04d2a7b93e650f1a2c47@latest",
  "system_prompt": "Open the address in the prompt in Chromium. Check that it loads, reads well on a 390-pixel-wide screen and has no broken links. Write what you find to /workspace/out/findings.md with a screenshot of each problem in /workspace/out/shots/. Then call submit_result.",
  "tools": ["bash", "read", "write", "screenshot"],
  "custom_tools": [],
  "input_manifest": [],
  "output_manifest": [
    { "path": "findings.md", "description": "What is wrong, if anything", "max_bytes": 100000 },
    { "path": "shots/", "description": "Screenshots of problems", "max_bytes": 50000000 }
  ],
  "environment": [],
  "size": "m",
  "timeout_minutes": 15
}
```
