This guide provides instructions on how to create a new Docs Agent
task file (.yaml) for automating a workflow.
To create a new task in your Docs Agent setup, follow these steps:
-
Go to your Docs Agent directory, for example:
cd ~/docs_agent -
Go to the
tasksdirectory:cd tasks -
Open a text editor and create a new
yamlfile, for example:nano my-new-task.yaml -
Copy and paste the following task template:
tasks: - name: "<TASKNAME>" model: "models/gemini-1.5-flash" description: "<DESCRIPTION>" preamble: <”PREAMBLE>” steps: - prompt: "<PROMPT_1>" - prompt: "<PROMPT_2>" - prompt: "<PROMPT_3>" -
Update the task name (
<TASKNAME>). -
(Optional) Update the model (see this Gemini model code).
-
Update the task description (
<DESCRIPTION>). -
(Optional) Update the preamble (
<PREAMBLE>).Note: The
preamblefield is not required. If it's not used, remove thepreamblefield. -
Update the prompts (
<PROMPT_#>). -
(Optional) Add more prompts under the
stepssection. -
Save the file and exit the text editor.
-
To verify that your new task is available, run the following command:
agent runtask -
Run the new task using the task name:
agent runtask --task <TASKNAME>For example:
agent runtask --task MyNewExampleTaskIf your task accepts custom input, you can run it with the
--custom_inputfield, for example:agent runtask --task MyNewExampleTask --custom_input ~/my_project/my_example_doc.md
The example task below is created using only the required fields:
tasks:
- name: "MyExampleTask"
model: "models/gemini-1.5-flash"
description: "An agent example that is created using only the required fields for a task."
steps:
- prompt: "This is my first prompt."
- prompt: "This is my second prompt."
- prompt: "This is my third prompt."
A task can have one prompt step at a minimum.
For more examples, see the tasks directory.
This section contains more prompt examples and optional fields.
A step that runs the helpme command:
steps:
- prompt: "Revise the PSA email draft above to be more concise and better structured."
A step that runs a POSIX command:
steps:
- prompt: "git --no-pager log --since=2024-10-15"
function: "posix"
Important: To run a POSIX command, the function field
must be set to posix.
The file flag reads the specified file and added its content
to the prompt's context.
A step that runs the helpme command with the file flag:
steps:
- prompt: "Analyze this file to understand the overall structure and key concepts."
flags:
file: "/home/user/docs_agent/README.md"
A step that runs the helpme command with the file flag and accepts custom input:
steps:
- prompt: "Analyze this file to understand the overall structure and key concepts."
flags:
file: "<INPUT>"
default_input: "/home/user/docs_agent/README.md"
When this step is run, the <INPUT> string will be replaced with
the value provided in the --custom_input field at runtime.
The allfiles flag reads all the files in the specified directory
and added their content to the prompt's context.
A step that runs the helpme command with the allfiles flag:
steps:
- prompt: "Analyze the files in this directory to understand the overall structure and key concepts."
flags:
allfiles: "/home/user/docs_agent/docs"
A step that runs the helpme command with the allfiles flag
and accepts custom input:
steps:
- prompt: "Analyze the files in this directory to understand the overall structure and key concepts."
flags:
allfiles: "<INPUT>"
default_input: "/home/user/docs_agent/docs"
When this step is run, the <INPUT> string will be replaced with
the value provided in the --custom_input field at runtime.
Similar to a foreach loop, the perfile flag reads each file in
the specified directory and added the file's content to the prompt's
context. For instance, if there are 5 files in the input directory,
the same prompt will run 5 times using each file's content as context.
A step that runs the helpme command with the perfile flag:
steps:
- prompt: "Analyze this file to understand the overall structure and key concepts."
flags:
perfile: "/home/user/docs_agent/docs"
A step that runs the helpme command with the perfile flag
and accepts custom input:
steps:
- prompt: "Analyze this file to understand the overall structure and key concepts."
flags:
perfile: "<INPUT>"
default_input: "/home/user/docs_agent/docs"
When this step is run, the <INPUT> string will be replaced with
the value provided in the --custom_input field at runtime.
A step that runs the helpme command and the name field
(which is for display only) is provided:
steps:
- name: "Revise the PSA email"
prompt: "Revise the PSA email draft above to be more concise and better structured."
A step that runs the helpme command that explicitly mentions
which function to use:
steps:
- prompt: "Revise the PSA email draft above to be more concise and better structured."
function: "helpme"
Without the function field, the prompt is set to use the helpme command by default.
A step that runs the tellme command:
steps:
- prompt: "Does Flutter support Material Design 3?"
function: "tellme"
Using the tellme command requires a vector database setup.