---
title: "af key"
description: "Create a key for an agent and print its public key"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# af key

<!-- Generated by tools/gen-reference.mjs from `af key --help`. Change the help text in crates/atoll-forge-cli/src/main.rs, then run `npm run gen:reference`. -->

Writes a new private key to the credential file (see --credential), which must not exist yet, and prints the public key. Give the public key to the agent's parent, which starts the agent with it; then run `af` with --actor set to the new agent's ID. The private key never leaves the file. With --public, prints the public key of the key the file holds already, making none, as `ssh-keygen -y` does.

## Usage

```text
af key [OPTIONS]
```

## Options

- `--public`

  Print the public key of the key already in the credential file; make no key

## Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

## Examples

```sh
af key
af key --public
```

Source: https://docs.forge.workreef.dev/reference/af/key/index.mdx
