# Finish Any Story

Type the opening of a story and a Claude agent writes the ending, as an artifact.

- Page: https://perceivo.ai/examples/finish-any-story
- JSON: https://perceivo.ai/registry/example/finish-any-story.json
- Kind: example
- Revision: 2 (published 2026-10-19, produced 2026-10-19)
- Previous revision 1 (published 2026-10-11): https://perceivo.ai/registry/example/finish-any-story/r1.json
- Repository: https://github.com/ConceptBuilderAI/perceivo/tree/v1.0.0/examples/orchestrations/finish-any-story

## Validation

- SDK: rc 0 at 2026-10-19T14:34:04Z, revision 8b1e0f6ac1d9b07ec9f693eec0672e467432efe4
- Platform: rc 0 at 2026-10-12T00:09:11Z, dms bundle_validation.validation_errors+validate_component@d7eb31176, revision d7eb3117642ac5cca246060039215e64b5a439fb

## Secrets

- `ANTHROPIC_API_KEY` (anthropic): The Storyteller agent calls Claude with your key.

## Download

- finish-any-story.zip: https://perceivoprodpublicmedia.blob.core.windows.net/media/packages/finish-any-story/r4/finish-any-story.zip
  sha256 9db01279be868ca6ecffcbc21d21065b45aff522c68b33ea9b87c3ef43da165a

## Packages

- Finish Any Story (orchestration, finish-any-story.cborchestration.json): https://perceivoprodpublicmedia.blob.core.windows.net/media/packages/finish-any-story/r2/finish-any-story.cborchestration.json
  sha256 1bd2517b57227215610470cf208ca9ea469da05e152fc5765f2bdb9e5a2b0832

## At home

1. Download the example folder and open a terminal in it.

2. Install the Perceivo SDK and Jupyter.

```sh
pip install "perceivo==1.0.0" notebook
```

3. Put your Anthropic API key in ANTHROPIC_API_KEY (PowerShell: $env:ANTHROPIC_API_KEY = "<your key>").

```sh
export ANTHROPIC_API_KEY=<your key>
```

4. Open the notebook and run the cells top to bottom.

```sh
jupyter notebook run.ipynb
```

## Command line

1. Install the Perceivo SDK.

```sh
pip install "perceivo==1.0.0"
```

2. Get the examples and open this one.

```sh
git clone --branch v1.0.0 --depth 1 https://github.com/ConceptBuilderAI/perceivo.git && cd perceivo/examples/orchestrations/finish-any-story
```

3. Put your Anthropic API key in ANTHROPIC_API_KEY (PowerShell: $env:ANTHROPIC_API_KEY = "<your key>").

```sh
export ANTHROPIC_API_KEY=<your key>
```

4. Check the orchestration and its components.

```sh
perceivo validate orchestration .
```

5. Run it with the sample request.

```sh
perceivo run orchestration . --input-file input.json
```

## Transcript

[0:00] Perceivo Examples: Finish Any Story
[0:06] In this short video, we're going to look at Finish Any Story, a Perceivo example.
[0:12] It's a three-component orchestration: you give it the opening of a story, and a Claude agent writes the ending.
[0:19] Story Start puts your opening into the artifact, which is the work itself, and its word count into the response data, which is small facts about the work.
[0:29] The storyteller reads the story from the artifact, asks Claude for an ending, and returns a new artifact holding the whole story.
[0:37] Because the artifact changed, the platform takes a snapshot of it.
[0:41] Don't forget to bind your secret before you try to run it.
[0:45] This agent is looking for an Anthropic API key.
[0:49] We just happen to have one.
[0:51] And if you're doing this in the SDK, you declare the secret in the agent's YAML,
[0:56] read it in your code with perceivo.secrets.get,
[1:01] and on your machine, it comes from an environment variable, or your .env file, with that same name.
[1:07] On the platform, binding does the matching for you.
[1:11] The storyteller also calls Anthropic's API, so your organization also needs an outbound route to api.anthropic.com.
[1:20] To check, go to Security, then Access Control, then Outbound.
[1:25] Here's the route for api.anthropic.com.
[1:30] If yours isn't there, click Add Route, and enter the host, port 443, and HTTPS.
[1:37] Routes belong to your whole organization, so you only add each one once.
[1:42] Now let's run it.
[1:44] I'm going to give it the opening of a story about a lighthouse keeper.
[1:49] OK, let's give it a try.
[1:53] ...and there we go. All finished.
[1:56] Click on Conversation, and there's the ending Claude wrote.
[2:01] You can view the logs here in the orchestration.
[2:04] The Snapshots tab shows the story artifact before and after the storyteller.
[2:11] Or all your system logs are accessible from the left-hand menu.
[2:14] This is going to show all logs, for all features.
[2:18] Here you can see our orchestration run in started, loading, running and completed status.
[2:24] Like all the examples, you can find the source code in our open-source SDK repository on GitHub.
