Skip to content

Prompt

A role's instructions are its prompt. Keep it in a file and load it with prompt_file(), relative to the file that calls it.

Role(name="builder", instructions=prompt_file("prompts/builder.md"))

Write each type the role accepts into the prompt as {{TypeName}}, with no spaces inside the braces. When the step runs, AGL fills it in with the value as JSON.

prompts/builder.md:

Implement this request: {{Request}}

A reviewer found these problems, if any: {{Review}}

The prompt and accepts must name the same types. AGL checks this when you call the role's function.

Reference

agl.sdk.prompt_file(path)

Reads a role's prompt out of a file.

Parameters:

  • path (str | Path) –

    The file to read. A relative path is resolved against the directory of the module that called this, never against the directory agl was started in.

Returns:

  • str –

    The file's text, decoded as UTF-8.

Raises:

  • InputError –

    There is no such file, it is a directory, it cannot be read, it is not UTF-8, or it is empty.