# AI engineer shipping agents

> Ten minutes in your browser: see every model, SDK and MCP server your agent uses, where untrusted input can reach them, and which edge to fix first.

Source: https://keryn.dev/docs/start/ai-engineer/

**You get:** an AI bill of materials for your agent, a map of where untrusted input can travel, and the one edge to fix first. **You need:** a current browser. Nothing is installed and no account is needed.

## 1. Scan the sample agent (2 minutes)

1. Download [trip-planner.zip](https://keryn.dev/samples/trip-planner.zip): a FastAPI trip planner whose GPT-4o agent searches the web and books trips through tools, with a calendar MCP server in `.mcp.json`. Its code is [shown below](#the-samples-code).
2. Open [keryn.app](https://keryn.app). Under **Scan**, choose **File** and drop the zip on the box. The scan runs in your tab.

## 2. What your agent is made of (3 minutes)

Open **AI-BOM**:

![The AI-BOM of Keryn Web for trip-planner.zip: the gpt-4o model, the calendar MCP server, the Claude Code configuration and the openai SDK, each with where it is used.](https://keryn.dev/screens/role-ai-aibom-1280-light.webp)

*The AI-BOM of trip-planner.zip: the gpt-4o model, the openai SDK, the calendar MCP server and the Claude Code configuration. Taken from keryn.app main-5g3Rr4q1.js.*

| Asset | Type | Where |
|---|---|---|
| gpt-4o | model | `trip/agent.py:19` |
| openai 1.40.0 | library (LLM SDK) | `requirements.txt:2` |
| calendar | service (MCP server) | `.mcp.json:3` |
| Claude and Claude Code | service (AI coding tool) | `.mcp.json` |

The `.mcp.json` file is what a coding agent reads, so the calendar server is part of what your developers' agents run. The badge on each row is the worst finding in the files that use it. **Share and export** downloads the list as a **CycloneDX 1.6 AI-BOM**.

## 3. Where untrusted input can go (4 minutes)

Go back to **Decision** and choose **Open the trust map**:

![The trust map of trip-planner.zip on the Risky paths view: the user prompt, the agent, OpenAI, the calendar MCP server and Claude Code in their zones, with fix here on the edge from the prompt to the agent and on the agent calling the calendar server.](https://keryn.dev/screens/role-ai-trustmap-1280-light.webp)

*The trust map of trip-planner.zip on the Risky paths view: the user's prompt reaches the agent, and the agent calls the calendar MCP server; both edges say fix here. Taken from keryn.app main-5g3Rr4q1.js.*

The map puts each part in a zone (the public internet, AI processing, outside services) and draws an edge wherever one can reach, call or send to another. Dashed edges are inferred from the code. **Fix here** marks the edge where one control would cut the riskiest path: here, the agent's call to the calendar server, which runs through `npx` with no pinned version. That is also the scan's only error.

**Show riskiest path in the repository** takes you to the lines. **Edit proposed model** lets you correct what the scan inferred, for example mark an edge that already needs a person's approval.

### What the map reads

The map reads Python, JavaScript/TypeScript, Java, Kotlin, C# and Go source, and tool declarations kept as OpenAI-style JSON (a `*tools*.json` file). A framework's tools and entry points are read only when the file imports that framework. Tools: LangChain and LangGraph (including plain functions given to `ToolNode`, `bind_tools` or `create_react_agent`, also from another module), OpenAI Agents SDK, Vercel AI SDK, Mastra, MCP SDKs, Pydantic AI, LlamaIndex, CrewAI, smolagents, AutoGen and AG2, Google ADK, Semantic Kernel, and the OpenAI, Anthropic and Gemini tool schemas. Entry points: FastAPI, Flask, Quart, Starlette, aiohttp, Django, Streamlit, Chainlit and Gradio in Python; Next.js, Express, Hono, Fastify and Koa in JavaScript and TypeScript. In Java and Kotlin: `@Tool` methods of Spring AI and LangChain4j, and Spring MVC routes. In C#: Semantic Kernel `[KernelFunction]` methods, Microsoft.Extensions.AI `AIFunctionFactory.Create` tools and ASP.NET minimal-API routes. In Go: tools of the MCP Go SDKs (mark3labs/mcp-go and the official go-sdk), and `net/http` and gin routes. A tool or route the map does not show is not proof it is absent.

## 4. A second opinion (1 minute)

**Investigate with AI** on the Decision view shows recorded example reviews until you add your own model key under **Settings**, **Connectors**. With a key, a model you choose reviews up to 60 findings; nothing is sent until you press the button, and a verdict never changes a finding's evidence level.

## The sample's code

These are the files in `trip-planner.zip`, from the [Trust Canvas journey](https://keryn.dev/docs/journeys/trust-canvas/), which models the same agent by hand.

```python
from fastapi import FastAPI
from pydantic import BaseModel

from trip.agent import plan

app = FastAPI()

class Chat(BaseModel):
    message: str

@app.post("/chat")
def chat(body: Chat) -> dict:
    return {"reply": plan(body.message)}
```

```python
import smtplib
import sqlite3
import urllib.request
from email.message import EmailMessage

def search_pages(url: str) -> str:
    """Read a travel page the user pointed at."""
    with urllib.request.urlopen(url, timeout=10) as resp:
        return resp.read().decode("utf-8", "replace")[:20000]

def book_trip(destination: str, traveller: str) -> int:
    """Create a booking and return its id."""
    db = sqlite3.connect("bookings.db")
    cur = db.execute("INSERT INTO bookings (destination, traveller) VALUES (?, ?)", (destination, traveller))
    db.commit()
    return cur.lastrowid

def send_itinerary(to: str, body: str) -> None:
    """Mail the itinerary to an address."""
    msg = EmailMessage()
    msg["To"], msg["From"], msg["Subject"] = to, "trips@example.invalid", "Your itinerary"
    msg.set_content(body)
    with smtplib.SMTP("localhost") as smtp:
        smtp.send_message(msg)
```

```python
import json
import os

from openai import OpenAI

from trip import tools

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

TOOLS = {"search_pages": tools.search_pages, "book_trip": tools.book_trip, "send_itinerary": tools.send_itinerary}

def plan(message: str) -> str:
    messages = [
        {"role": "system", "content": "You plan trips. Use the tools when the traveller asks."},
        {"role": "user", "content": message},
    ]
    for _ in range(5):
        reply = client.chat.completions.create(model="gpt-4o", messages=messages, tools=[
            {"type": "function", "function": {"name": n, "parameters": {"type": "object"}}} for n in TOOLS
        ])
        choice = reply.choices[0].message
        if not choice.tool_calls:
            return choice.content
        for call in choice.tool_calls:
            result = TOOLS[call.function.name](**json.loads(call.function.arguments))
            messages.append({"role": "tool", "tool_call_id": call.id, "content": str(result)})
    return "I could not finish planning."
```

```json
{
  "mcpServers": {
    "calendar": { "command": "npx", "args": ["-y", "@example/calendar-mcp"] }
  }
}
```

```text
fastapi==0.115.0
openai==1.40.0
```

## With the CLI (pre-release builds)

With a pre-release build, the same scan writes the AI-BOM as CycloneDX and the findings as JSON; these commands run against the sample in this page's tests. Exit 1 is the gate: the unpinned MCP server is an error.

```sh
keryn scan . -q --aibom aibom.cdx.json --json result.json
```

```sh
jq -r '.components[] | "\(.type) \(.name)"' aibom.cdx.json | sort
jq -r '.findings[] | select(.severity == "ERROR") | "\(.ruleId) \(.path):\(.line)"' result.json
```

```text
library openai
machine-learning-model gpt-4o
seceng.agentcfg.mcp-npx-unpinned-package .mcp.json:3
```

The CLI's CycloneDX file lists the model and the SDK. The MCP server and the coding-agent configuration are in Keryn Web's AI-BOM, and reach the CLI as findings like the one above; the CLI's AI-BOM does not list them yet.

## Next

- [The Trust Canvas](https://keryn.dev/docs/guides/trust-canvas/): lenses, chokepoints and the hand-written model.
- [Agent skills and instruction files](https://keryn.dev/docs/guides/agent-skills/) and [MCP Guard](https://keryn.dev/docs/guides/mcp-guard/).
