Skip to content
AI Knowledge MapSearch / Text directory

II. How to build an agent

Introduction

There are usually three starting points:

  • Start with a blank project and add the capabilities you need.
  • Modify an existing template.
  • Describe your requirements in natural language and let the platform generate a first version.

We will begin with a few settings so you can see what each one does. Use the same approach to check a template or a generated configuration.

First we will build a topic assistant that answers from supplied materials, then cover decisions and scheduling, tool execution, background operation and real-time voice. For your first build, choose one small, checkable task: answering questions about an event's time, fees and eligibility, for example. Once those answers pass inspection, consider connecting registration or personal-record tools.

Decide where the finished agent will run and who will use it. A question-answering assistant might be a chat page opened through a link. An agent inside a workflow might be one processing step. A background task needs an unattended execution entry point. Choose a platform for these uses. Section 1 covers creating a dedicated assistant within a platform and configuring knowledge for an existing agent.

1. Build a topic assistant with a knowledge base

1.1 Create a dedicated assistant in a platform: ChatGPT

Open ChatGPT on the web, click the three dots on the left and select GPTs.
Click Create at the upper right, then choose to create a plugin or a GPT; the latter option is being phased out.

SettingWhat to provide
Name and descriptionCore purpose, audience, tone and answer depth.
InstructionsFunctions, scope, operating limits and examples: what users provide, what results look like and what to do with missing information.
Conversation startersShow what users can ask; examples in the instructions show how to answer.
KnowledgeData sources, existing materials and the purpose of each source.
ToolsEnable the required capabilities; configure connections for external services.

The principles are the same as writing a good prompt, but the configuration must handle similar tasks repeatedly across users and materials. No special format or magic phrase is required. Let's look at instructions, conversation starters, knowledge and tools.

Instructions

I. Functions
  1. Start each task description with a verb.
  2. Specify required materials, distinguishing essential from optional inputs for each task.
  3. Describe the processing steps for each task.
  4. Define deliverables that can be checked.
II. Scope
  1. Define the subject scope, as with functions.
  2. Define action boundaries: what may change, what must not happen and what requires confirmation.
III. Operating limits

Specify what to do in each situation: ask a question, use a default or mark information as unspecified. Common situations include:

  1. Missing information that determines the result.
  2. Required facts absent from the materials.
  3. Conflicting source conclusions.
  4. Tool failures.
  5. Missing preferences with little effect on the result.
  6. Task completed, task incomplete or attempts unsuccessful.
IV. Examples

Provide common user questions and examples of good replies.

Examples should teach the model:

  1. How to complete a normal task.
  2. When to ask and when to continue.
  3. How to handle easily confused requirements.
  4. How to resolve conflicts.
  5. How to use tools.

They should also demonstrate format, tone and answer structure. Vary them so the model does not learn unintended patterns. If every example ends with a follow-up question, it may learn to always ask one.

Some examples use special markers:

<examples> and </examples> mark the beginning and end of a group.

<input> and <output> distinguish user input from an ideal reply.

Ordinary prose works too.

Conversation starters

These appear when a user starts, showing how to prompt the assistant and indirectly communicating its main function.

Good starters are:

  1. Short.
  2. Based on real user questions.
  3. Clear about the action and its object.
  4. Limited to existing capabilities.
  5. Based on data the assistant can access or the user can later provide.

Usually prepare at least three starters.

Knowledge

You can describe sources, available materials and their purposes in one passage.

For each source, include its name, version, access method and applicable scope.

Explain which material to use for which task and what information to take from it. When necessary, state what must not be inferred from it.

If the knowledge settings only offer an upload button, put these instructions in the main instructions. For numerous or difficult-to-classify materials, upload a separate source guide and tell the agent when to read it.

Tools

In ChatGPT's GPT builder, use Actions to connect external tools. For Enterprise users, GPT creation is due to transition to plugins after December; the plugin creation skill can help an agent connect external tools.

If Actions is missing, Apps may be selected, or you may not yet have spoken to the builder's agent. Actions and the recommended model appear after the first exchange.

Add credit with the tool provider where required, then connect the API key to the agent. If you cannot find the provider's API key page, ask AI to locate it.

A key may work across several agents and applications, but separate keys for each agent and purpose make revocation, usage tracking and permission management easier. Keep keys private: a leaked key may let someone else spend your balance.

1.2 Configure knowledge for an existing agent

If you already use Claude, WorkBuddy or Codex, connect your materials to that agent. In addition to one-off attachments, put reusable materials in project knowledge, a library or a fixed directory.

I. Global and project AGENTS.md files

AGENTS.md is a common instruction file for agents; capitalization matters. For Codex-backed chats, global instructions in ~/.codex/AGENTS.md can specify preferences and rules across projects. Other products have similar mechanisms: Claude Code uses ~\.claude\CLAUDE.md. These files load at startup.

For an individual project, add a project-specific AGENTS.md. Explain how to use its knowledge base and when to load each source, avoiding unnecessary reading and token use for every question.

The instruction file also takes context space. Keep it concise, clear and internally consistent. Store complex information and long procedures in separate files.

II. Let the agent read a local materials directory

Using Codex as an example:

  1. Organize related materials in a folder, or add a materials subfolder to an existing project.
  2. Select that folder as the current project or working directory in Codex.
  3. Give file or directory paths in the task and explain their purpose.
  4. Save ongoing rules in the root AGENTS.md; add them to the existing file if there is one.

For example, keep product manuals separate from writing examples:

knowledge/
├── AGENTS.md
├── product/
│   ├── manual.md
│   └── faq.md
└── writing/
    └── examples.md

In AGENTS.md, write:

For questions about product features and operations, first consult product/manual.md.
Use writing/examples.md for style; do not transfer its specific facts to new tasks.
Cite the source file and section in answers.
Knowledge-answering tasks in this project only read files. Editing source materials requires an explicit update request.

Some older platform versions cannot directly read materials nested in subfolders. Check that the intended files are accessible.

III. Connect external documents, knowledge bases or databases

When materials live in team documents, cloud storage or business systems and need ongoing updates, look for a suitable connector. Later tasks can then query the original system.

Document libraries
PreparationDetailsUsual provider
Access accountAn organizational account that can read the materials.Organization administrator.
ConnectionAn existing connector or an organization-provided MCP/API.Find it yourself; ask technical staff if unavailable.
Usage instructionsPurpose of each source, valid versions and citation requirements.You and the business owner.
Test questionsQuestions with known answers and matching source passages.You.
Business databases
Step 1: Tell technical staff what you need to query

Instead of just asking to connect the database, provide a request such as:

I need the agent to check order status and calculate paid sales by date and region.

Please provide the allowed data scope, read-only access method, field definitions and calculation rules, plus test questions for verifying results.

If the organization has a query API or MCP service, provide connection settings. If direct database access is required, provide instructions for the chosen tool.

Technical staff can choose between two approaches:

  • For fixed tasks, provide dedicated tools such as order lookup or sales totals, with order IDs, dates and other parameters.
  • For flexible analysis, provide a SQL tool that lets the agent inspect permitted schemas and generate queries.
Step 2: Connect the query tool to the agent

For a remote MCP service, follow the service connection steps. Database credentials can stay on the organization's server while you sign in with your organizational account.

If direct local access is permitted, existing tools are available. Google's open-source MCP Toolbox for Databases, for example, supports PostgreSQL and other databases; consult the official PostgreSQL integration tutorial.

For PostgreSQL, technical staff first need to:

  1. Install Toolbox and locate its executable.
  2. Prepare a read-only database account.
  3. Set the database host, port, database name, username and password in the execution environment.
  4. Verify network access and encrypted connection settings.

Enforce read-only access through the database account or server, then verify the connection with a small test.

2. Build a voice agent with memory

2.1 Configure memory across conversations

Cross-conversation memory lets an agent retain your preferences, confirmed information and ongoing work in a new chat. A learning assistant might remember your progress; a writing assistant, your preferred style; a work assistant, the plan you approved last time.

First decide where to store it. Start with built-in memory for a platform assistant. Use files if you want to inspect, edit and move records yourself. Consider an external memory service if several devices or agents need shared memory.

I. Use built-in memory

If you mainly use one product, check its built-in memory first. You usually do not need another database or service API.

Claude: Enable and manage memory in settings
  1. Open Settings → Your Claude and enable Memory from chats. Some interfaces still use Settings → Memory.
  2. State what to retain, for example: “Remember that when I learn new software, I prefer concrete steps before explanations.”
  3. Open Your memory → Manage to inspect topics; select an item to read, edit or delete it.
  4. Ask it to correct or forget changed information, then check the record.

Claude projects also have their own memory. Use account memory in project memory settings controls whether account memory is included. Information stored in one project is not necessarily used in every project. Claude's memory guide

WorkBuddy: Enable conversation memory generation

Click your avatar, open Settings → Memory and check that conversation memory generation is enabled. Open a generated record to read it; use the edit icon to request changes through conversation.

WorkBuddy's documentation says it summarizes the day's conversations each night. A newly stated fact may not appear immediately, so account for this delay when checking it. WorkBuddy's memory guide

ChatGPT: Enable local memory

Open Settings → Personalization and enable Enable Codex memories. Enter /memories in the current chat to check whether existing memories may be used and whether this chat may contribute to future memories. For chats involving MCP tools or web search, also check Allow memories from tool-assisted chats.

These memories are organized in the background and may not appear immediately. They use separate storage from account memory on ChatGPT's website. Check separately when moving to the web or another computer; signing into the same account does not by itself establish shared storage. OpenAI's memory guide

II. Save and update memory in files

Use plain text files if you want to inspect, edit, back up or transfer records to another agent. The agent must be able to read and write local files. A chat interface that only accepts attachments cannot automatically update a file on your computer.

Step 1: Create a fixed memory file

Create memory.md in an accessible working directory. Start with three categories:

# User preferences

# Confirmed background information

# Ongoing work

This filename is a convention you choose. Naming a file memory.md does not make every agent read it automatically.

Step 2: Define reading and writing in persistent instructions

Add the actual path and usage rules to the project instruction file from the previous section. Adapt this example:

The memory file is memory.md in the current project root.

At the start of each new chat, read it and use information relevant to the task.
Update it when I explicitly say "remember," or confirm that a preference should continue to apply.
Record only information I have confirmed. Do not store guesses, examples or undecided options as facts.
Give each entry a confirmation date. For temporary items, include the applicable period or completion status.
When information changes, update the existing entry rather than keeping contradictory current versions.
Delete the relevant entry when I ask you to forget it.
Report that information is saved only after a successful write. Explain if write permission is unavailable.

This example saves after an explicit request or confirmation. You can instead allow automatic organization of confirmed preferences and work progress, while retaining the rules against storing guesses and keeping conflicting entries.

Some products already maintain memory files automatically. Claude Code enables automatic memory by default in ordinary local sessions; use /memory to inspect settings and records. Memory is stored locally by project and does not automatically synchronize across computers. Check whether this meets your needs before maintaining another file. Claude Code's memory guide

III. Connect an external memory service

To share memory across devices and clients, store it in an external service. Every agent must connect to that service and use the same memory scope. Enabling two products' built-in memory separately does not connect them.

Mem0, for example, provides tools to save, search, update and delete memories, with MCP support.

IV. Decide what memory should retain

Define how to handle these categories:

  1. Long-term preferences: Distinguish “keep today's answer short” from “use short answers by default from now on.”
  2. Personal background: Retain confirmed facts useful to later tasks. Do not infer profession, personality or identity from one question.
  3. Ongoing work: Record progress, confirmed decisions and next steps; update the status when finished.
  4. Expiring information: Record applicable dates or conditions and reconfirm before use when necessary.
  5. Excluded information: Passwords, API keys and anything the user explicitly limits to the current conversation.

Consult the original conversation or work record for a full discussion history. A brief memory entry should not also serve as a complete chat backup.

2.2 Configure voice interaction

For a continuous, call-like exchange in which the agent listens and speaks, you need full voice conversation support.

I. Enable an existing assistant's voice mode

ChatGPT desktop
  1. Open the chat or Codex task you want to continue.
  2. Click Start voice chat, or Start new voice chat for a new conversation.
  3. Allow microphone access and choose a voice on first use.
  4. Speak, then click Stop voice chat to finish. You can set a shortcut in Settings → Voice → Voice chat hotkey.

If an existing task has no voice button, update the desktop app and its Codex host, then check account and workspace availability. Dictation and real-time voice chat are separate features; a microphone icon alone does not establish continuous conversation support. OpenAI's voice guide

Claude
  1. Open a chat on the web or in Claude Desktop and click the waveform near the input box. Mobile uses the waveform too.
  2. Allow microphone access. On mobile, choose a voice at first use; later adjust voice and speed in voice settings.
  3. Speak continuously in a quiet environment. In noisy surroundings, use Push-to-talk: hold to speak and release to send.

Claude can switch between text and voice in the same conversation while preserving context. Type URLs, names and other easily misheard details when useful. Claude's voice guide

II. Build a dedicated assistant on a voice platform

Choose a voice-building platform when you want to configure the voice, opening message and waiting time separately and share the assistant with others. ElevenLabs Agents, for example, provides web configuration, a test interface and website widgets.

Step 1: Create the assistant and reuse your task configuration

Sign in to ElevenLabs, open the Agents console, create an assistant and select Blank template.

On the Agent page, fill in:

  • System prompt: Use section 1.1 to define tasks, scope and handling rules. Start with your existing instructions, adding the voice-specific requirements below.
  • First message: The first sentence actually spoken when the user connects. It may introduce the assistant and ask how to help; this differs from clickable conversation-starter buttons.
Step 2: Configure language, voice and speed

Choose a voice and adjust Speed on the Voice page.

Step 3: Configure turn-taking and interruption

Find Turn eagerness in agent settings and start with Normal. Choose Patient if users often need time to think or form longer sentences.

To let users interrupt, check interruption under Advanced → Client Events. Configure waiting and interruption behavior in the actual settings; “do not interrupt me” in the prompt is insufficient. Conversation flow configuration

III. Add voice services to your application or existing agent

Use an API if you want to retain your website, character interface or existing agent. The agent must expose a callable interface, or you must be able to change its code.

Agent generates a final answer
        ↓
Program obtains the answer text
        ↓
Backend calls a service such as ElevenLabs with text, voice ID and model
        ↓
ElevenLabs returns audio
        ↓
Backend sends the audio to the current user's page
        ↓
The page's player plays it

3. Build an agent that runs automatically in the background

3.1 Scheduled and event-triggered execution

I. Ask an existing assistant to create a scheduled task

Specify when it runs and what it does each time

You can ask through conversation without learning scheduling expressions first. Replace the brackets with your task details:

Create a scheduled task.
Schedule: [one-time date, or frequency, exact time and time zone].
Work each run: [the task to execute].
Sources: [files, project, connected services or specified sites].
Scope: [objects to process, or the time period to cover].
Deliverable: [output, save location or notification method].
If nothing matches: [end the run, record "no updates," or another agreed action].

“Remind me to prepare a weekly report” and “read this week's records and write the report” are different requests. Include the actual work if you want it performed, rather than just a reminder.

ChatGPT: Create in chat, then check Scheduled

Describe the schedule and specify whether future runs should continue in the current conversation or run separately. After creation, open Scheduled to check the saved instructions, execution time and status.

For local project files, use the corresponding desktop project and keep the computer and app running. Web tasks use accessible uploads or connected services; they cannot directly use a folder on your computer. OpenAI's scheduling guide

WorkBuddy: Create in chat or Scheduled tasks

Describe a recurring need in ordinary chat, or open Scheduled tasks → arrow beside New → Create from task, add the requirements and send.

For manual setup, select Scheduled tasks → New and fill in:

  1. Name and prompt: Task name and work for each run.
  2. Model, expert, skills and connectors: Required capabilities.
  3. Workspace: The execution directory for local files.
  4. Repeat, time and validity: One-time or recurring rule, execution time and effective period.

After saving, check the card's next execution time and use Run for a test. Inspect results in run history. Pause future runs with the card's switch when no longer needed; this does not interrupt an already-started run.

Local tasks depend on the computer and client. Cloud tasks run remotely but cannot directly access local files. WorkBuddy's scheduling guide

II. Use built-in event triggers

For work that starts when something happens, look for supported events such as new email, new messages or repository updates. Connecting an application does not make every event available as a trigger; check the supported list.

Eligible ChatGPT accounts can create Gmail, Slack and GitHub event tasks on the web or mobile; creation is not available on desktop.

Connect and authorize the application, then ask:

Create an event-triggered task.
Event source: [account, channel or repository].
Trigger: [new events to handle and filtering conditions].
Work each run: [what to do with the received content].
Deliverable: [save location and when to notify me].

Check the task in Scheduled. Availability depends on plan and workspace settings. A task cannot use both an event trigger and a time schedule. OpenAI's event trigger guide

Put filters in the trigger settings where possible. To handle only a particular sender, configure that sender condition to avoid launching the agent for unrelated mail. Task instructions describe how to process matching events.

III. Use an automation platform when built-in triggers are insufficient

See also the automation workflows chapter. If the product does not support the application or trigger you need, a platform such as n8n can connect when to start, who processes the input and where results go.

You can use n8n Cloud to avoid local installation, or an existing organizational instance, which may require Docker. Begin with the shortest workflow:

Scheduled or event trigger → Agent processing → Save results or notify

Add a trigger node to a new workflow. A node is a step in the process.

For scheduled runs, add Schedule Trigger.

Add a rule under Trigger Rules, choose days, weeks, hours or another unit in Trigger Interval, then set the time. Check the workflow's time zone rather than assuming the server uses yours. Save and publish the workflow to activate its schedule. n8n Schedule Trigger

For event triggers, select the application's Trigger node.

For email, add Gmail Trigger:

  1. Create or select a Google connection in Credential to connect with. n8n Cloud supports Sign in with Google without configuring your own Google Cloud application.
  2. Select Message Received.
  3. Set the check frequency in Poll Times, with sender, label or search filters as needed.
  4. Fetch one matching email in a test and inspect the node output.

3.2 Keep it available around the clock

An agent that receives tasks all day and continues while you are away needs a continuously available execution environment. Built-in cloud features are the easiest starting point. Keep a local computer running when local software and files are essential. Deploy an independent program to a cloud platform or server when appropriate.

Separate two needs: waiting for new tasks and processing them when they arrive; and continuously advancing a goal from one part to the next. Staying online only provides a place to run. Continued progress also requires the goal and progress setup below.

I. Start with an existing cloud option

Use cloud execution if uploads, online documents, remote tools and APIs cover the task. Your computer need not stay on.

WorkBuddy: Run tasks in cloud mode
ChatGPT: Choose a cloud environment for Work

Select Work on ChatGPT's website, or choose Cloud when creating a task in a supporting desktop client. Upload the materials, connect tools and state the task.

According to the official documentation, cloud Work tasks can continue after the desktop app closes, with follow-up through web or mobile. Check whether the task has completed or is waiting for information or approval. Cloud and local Work

If the task reads local files or operates local tools through a connected computer, that computer must remain online. Cloud coordination does not move all its files and software to the cloud. Local access

For an ongoing responsibility

If your account has dots, you can use this persistent assistant. It has its own cloud computer, can follow up between conversations, and can pause, wake and resume as needed.

Create a dot, connect the applications it needs, then describe its ongoing goal, sources, deliverables and decisions that require you. Inspect individual tasks through Activity. Access to your own computer still needs a separate connection and an online computer. Getting started, tasks and memory

An existing workflow from section 3.1 can stay on n8n Cloud once published, without your personal computer running. Its agent interface, sources and tools must remain reachable too. If a step depends on a local program, taking that computer offline still affects the step. n8n Cloud

II. Keep a local computer running when its files and software are required

Use your computer when work depends on local files, signed-in sessions or software without a cloud interface. Configure its running conditions before considering another server.

Prevent sleep and configure background operation

For WorkBuddy desktop:

  1. Keep the computer powered, online and signed in to WorkBuddy.
  2. Under Settings → General → Permissions, enable the option to prevent sleep during execution. It prevents idle sleep while a local task runs, but the display may turn off.
  3. For remote availability between tasks, find the lock-screen execution settings under Settings → General. Choose to stay awake after the display turns off, or keep the display on if needed.
  4. Check the launch-at-startup setting under General. Starting the client after a restart does not by itself guarantee that interrupted work resumes; test that separately.

The setting stops preventing sleep once the task ends. It does not prevent manual shutdown or sleep. For all-day availability, check more than this one switch. WorkBuddy settings, lock-screen operation

For other local agents, check sleep prevention, exit behavior and startup settings. Minimizing, closing a window and quitting can have different effects. For desktop operations, test whether the required action works while locked.

III. Keep a long-running task progressing

For a large document collection or an ongoing project, staying online is insufficient. The agent also needs to know what to do next and when it is finished.

Use a product's persistent-goal feature first

For Goal mode in ChatGPT desktop or Codex, enter /goal and provide the goal, constraints and checkable completion criteria. Use the goal progress bar to pause, resume or change it.

This keeps work focused on a goal; it does not expand permissions or let a local program continue after shutdown or lost connectivity. The documentation recommends pausing before an expected disconnect and resuming when conditions recover. Long-running work

Save actual progress

For your own agent, require a progress file or database update after each stage, including:

  • Completed work and output locations.
  • Current work and the last successful step.
  • Remaining tasks and known problems.

On restart, read and verify these records before continuing. Use the files or external storage from section 2.1, recording execution progress here.

Manage growing context

Long tasks accumulate conversations, file contents and tool results. Alongside saving progress, control what enters each round. Otherwise, the task may exhaust context before finishing or struggle to find relevant evidence among old material.

1. Prefer built-in automatic compaction.

Compaction summarizes older conversation to free space. Claude Code compacts automatically near its context limit. Use /context to inspect usage or /compact to compact manually with a chosen focus.

Add Compact Instructions to CLAUDE.md to preserve the current goal, key decisions, unfinished work and verification results. Keep fixed rules in persistent instructions too, because summaries may omit details from early messages. Claude Code context

Codex CLI also provides /compact to replace older conversation with a short summary. This is a client-specific command, not a command for every chat product. OpenAI's command guide

Manual compaction suits supervised work. For unattended runs, confirm automatic context management or arrange program-controlled compaction at suitable stages. A prompt saying “compact when full” cannot replace this software capability.

2. Read only what the current stage needs.

Divide the task into stages that can be completed and checked separately. Read the files or retrieval results for the current stage. Keep full sources, detailed logs and finished outputs externally; retain summaries, key conclusions and source locations in current context, rereading originals when needed.

For many documents, save each document's output separately and read those outputs for the final synthesis. All source text, tool results and editing history need not remain in one conversation forever. Anthropic's context engineering practices

3. Continue in a fresh context after a stage.

Start the new session by reading the task and latest handoff, checking existing outputs, then loading materials as needed. Files and records connect the work instead of an ever-growing chat history. Anthropic's long-running task practices use this staged approach too. Long-running agent harnesses

Add to project instructions:

Read only the materials required for the current stage. Save detailed results in output files.
At each stage's end, update progress with key decisions, evidence locations and the next step.
At a new session's start, read the task and latest progress, then verify existing outputs before continuing.
If a summary leaves a fact uncertain, check the original source instead of filling it in.

Around-the-clock operation provides continued availability and conditions for ongoing work. The agent may wait when finished or idle, and pause for quota limits, tool failures or human decisions. Next, configure how it handles these situations unattended.

3.3 Configure unattended behavior

In ordinary chat, the agent can ask questions and you can correct it immediately. Unattended work needs advance decisions about what can continue, what must stop and how to hand problems back to you.

Add handling rules to the task prompt or persistent instructions; in n8n, use the AI Agent's System Message. Configure permissions, approvals and timeouts in the software or tools as well.

I. Decide whether to continue, skip or pause when information is missing

Section 1.1 covered missing information and conflicting sources. Here, specify how a run ends when no user reply is immediately available.

SituationSuitable actionWhat to specify
Missing preferences that do not affect facts or actions, such as layoutContinue using agreed defaults.Which defaults, and whether to mention them.
One independent batch record lacks essential fieldsSkip it and process the rest.Save its ID, missing information and unprocessed work.
Missing evidence determines the overall result, or the action target is uncertainStop dependent work.Save completed outputs and list questions.
The user must choose, or a source conflict cannot be resolvedMark pending and retain candidates.Explain options, differences and the required decision.

For example:

This task runs unattended. Handle problems as follows:
Use agreed defaults for missing wording or layout preferences; do not wait for these.
If one record lacks essential material, save its ID and reason, skip it, and continue only with independent records.
If the overall basis or action target is uncertain, stop related actions, save existing outputs and list questions.
Do not count unprocessed, pending or failed items as completed.

You can skip an independent record, but not evidence needed downstream. If one file is unreadable, other independent files may continue. If an entire dataset needed for totals is missing, partial figures cannot be delivered as complete statistics.

II. Configure direct actions and human approval

Enforce the required access scope

Check which operations the task actually needs. Reading, drafting and formally sending can be authorized separately. A drafting task can omit send tools; a query task can use a read-only account. Enforce restrictions through tools, accounts or servers.

Send a request when approval is needed

Human approval often suits external sending, changes to important business records, deletion and actions beyond agreed scope.

In n8n, add approval for selected tools:

  1. Click the AI Agent node's Tools connector to open the tool panel.
  2. Under Human review, choose a channel such as Slack, Telegram or n8n Chat.
  3. Configure channel credentials and the recipient or conversation.
  4. Connect tools requiring approval to the human review step's tool connector. Connect other tools normally.

Without approval support, generate a draft, action list or pending record and notify you to continue. Specify that no confirmation means pending, with no execution. If a deadline is needed, define whether expiry cancels or escalates; silence is not approval.

III. Limit retries and define stopping conditions for tool failures

Distinguish failure types rather than saying “keep trying”:

  • Temporary network or service failures: Retry a limited number of times with specified intervals.
  • Expired login, missing permissions or invalid input: Record the cause and stop the affected step until fixed.
  • An action was submitted without a clear result: Check the actual state before deciding whether to retry.

The last case matters: a send timeout can mean either no message was sent or the receipt failed after sending. If you cannot establish the result, mark it “pending verification” instead of automatically sending again.

In a node's Settings, configure Retry On Fail for suitable operations, with attempt and waiting limits. Use On Error → Stop Workflow to stop the process, or Continue (using error output) to route errors to a dedicated branch while independent work continues. n8n node settings

The continuation branch must handle the error explicitly, not treat failed output as normal input. Repeated retries do not fix expired authentication. More complex recovery and duplicate prevention are addressed in workflow design.

IV. Set limits for each run

For retrieval, multiple tools or large batches, set limits on items, execution time, attempts and usage. Base the numbers on normal test runs, allowing reasonable variation. No single limit suits every task.

In n8n:

  1. Open the workflow's upper-right Settings, enable Timeout Workflow and set Timeout After.
  2. Set Max Iterations in the AI Agent node options.
  3. Set a maximum retrieval count where the data node supports it, leaving the rest for later runs.

Workflow timeout and agent iterations limit different scopes and cannot replace each other. n8n Cloud also imposes plan-specific maximum timeouts. Workflow timeout, agent iterations

On reaching a limit, report completed and remaining work without raising the budget or expanding scope automatically. Save progress by stage as in section 3.2, before a forced timeout prevents saving.

V. Completed, pending and failed work

Section 3.1 configured output locations. Also define run status:

  • Completed: Agreed items processed and results saved; verify delivery if required.
  • Partially completed: Keep usable outputs and list skipped, failed and unprocessed items.
  • Awaiting approval: State the proposed action, affected objects and required decision.
  • Failed or pending verification: State the last successful step, error and place to investigate.

“Report generated, delivery failed” needs separate generation and delivery statuses rather than a single “completed.”

Configure notifications for the task: summarize normal completion as agreed; promptly report pending decisions and failures blocking later work; retain only run records when nothing changes. Include the task name, issue summary, output or run link and your next action.

For WorkBuddy local schedules, enable scheduled-task output notifications in Settings → General. Its mobile app can receive completion, approval and failure notifications from a linked computer. Notification guide

In n8n, configure failure notifications separately:

  1. Create a workflow starting with Error Trigger, followed by an email or message node with recipient and error summary.
  2. Save it, then select it in the original workflow's Settings → Error workflow.
  3. Cause a controlled error through an automatic trigger in a published test workflow and verify the notification. Manual execution errors do not activate this Error Trigger. Error handling, Error Trigger testing conditions

4. Publish and maintain an agent

4.1 Publish an agent

There are three kinds of publication:

  • An assistant people use directly: Through a link, chat channel or API to your configured agent.
  • A configuration people copy: Instructions, source guides or workflow templates imported into their accounts, with their own materials and connections.
  • Source code people can modify and redistribute: Programs and licenses that let users modify, deploy or distribute them.

I. Ownership: Establish what you may publish

Check who can authorize publication and which third-party materials you used.

  1. Your own or your team's work: Check ownership of code, instructions and documents. For collaborations, commissions and employment work, inspect contracts and organizational rules. Authorship alone does not establish personal publication rights.
  2. Third-party code, templates and assets: Find their licenses or permissions. Check modification, redistribution, commercial use and required notices.
  3. Knowledge-base materials: Buying, downloading or being allowed to read something does not establish redistribution rights. Check whether internal documents, customer records and paid content may support a public service and how much may be shown.

II. Open-source licenses: Specify how others may use your work

Choose a license when releasing source for modification and distribution. A public repository without a license does not give everyone unrestricted rights to modify and distribute it. GitHub's licensing guide

The main differences among these four licenses concern proprietary modifications and when source must be provided.

1. MIT: Allows modification, commercial use and proprietary versions

Consider MIT if you want easy reuse and accept others building paid, proprietary products from your code.

  • Allowed: Copying, modifying, merging, distributing and selling the code, including within proprietary software without publishing added or changed source.
  • Required: Retain the copyright and full license notice in copies or substantial portions. Proprietary distribution does not permit removing the original notices.
  • Not required: Returning improvements to you or licensing the entire product under MIT.

For example, someone can improve your MIT-licensed agent framework and sell proprietary software if they meet the notice requirements. MIT does not suit a requirement that modified versions remain open. MIT license and explanation

2. Apache-2.0: Allows proprietary versions with explicit patent and modification rules

Consider Apache-2.0 if you accept proprietary products but want explicit treatment of contributors' relevant patents. Compared with MIT, it adds:

  • An explicit patent grant: Contributors grant rights to covered patents necessary to use their contributions. This is not a grant to all their patents or a guarantee against third-party infringement.
  • Patent-litigation consequences: Bringing specified patent litigation alleging infringement by the work or a contribution terminates the patent licenses granted for that work under the license.
  • Modification notices: Distributed modified files need prominent change notices, alongside the license and applicable notices. Preserve applicable attribution from an original NOTICE file under the terms.
  • No general trademark grant: A code license does not authorize using the project's name, trademarks or logo as your product's brand.

It permits proprietary modifications and does not require returning improvements. Its grants and notice rules are more detailed than MIT's. Apache-2.0, sections 3, 4 and 6

3. GPL-3.0: Preserve recipients' access to source and modification rights when distributing

Consider GPL-3.0 if recipients of your program or covered modifications should be able to inspect, modify and redistribute the source.

  • Charging is allowed: You may sell the program or charge for installation and maintenance, but cannot remove recipients' GPL modification and redistribution rights through a fee agreement.
  • Distribution requires corresponding source or an allowed way to obtain it: For example, offer matching source alongside an installer download. An old repository that does not match the distributed version is insufficient.
  • Covered modifications cannot simply become proprietary: Distribution must license the whole covered work under the GPL, not just publish the few lines you changed.

Corresponding source includes source and related scripts needed to modify, build and run the program. It does not automatically encompass every independent program in the company. Coverage of combined code depends on the actual combination. GPL-3.0, sections 1, 5 and 6

Private modification and use do not by themselves require publication. Running software on a server without giving users copies generally does not, through network interaction alone, require providing those users the modified source under the GPL. This is a key difference from AGPL. GPL definitions and section 2

4. AGPL-3.0: Offer corresponding source to users of a modified network service too

Consider AGPL-3.0 for an agent server if you want others deploying modified websites or APIs to provide the modified source to users.

It retains GPL-like distribution requirements and adds a network-service requirement: if you modify the program and users interact with that version over a network, prominently offer those users free access to its corresponding source. A service might provide a source download matching its deployed version.

“Users only visit the website; they do not download the program” does not avoid this requirement. The offer is for interacting users and need not specifically use GitHub. Running an AGPL program does not automatically require opening every other independent system on the server. AGPL-3.0, section 13 and corresponding source

AGPL permits commercial use and paid services. It governs source access and subsequent rights rather than prohibiting revenue. AGPL license and explanation

All these licenses permit commercial use. A noncommercial requirement needs a different permission scheme and should not be called open source under the Open Source Initiative's definition. Open Source Definition

To add a license on GitHub:

  1. Open the repository and select Add file → Create new file.
  2. Name it LICENSE and click Choose a license template.
  3. Choose the applicable license and check the year, rights holder and other required fields.
  4. Click Review and submit, then Commit changes.

In a local project, create LICENSE with the full license text. A sentence saying “this project is open source” is insufficient. Do not edit license terms while retaining the original license name. Adding a license

III. Describe the published work

For an online assistant, place usage instructions on its introduction page or near the entry point, usually in the root README.md for a project.

For a copyable project, also provide installation, configuration and startup steps. Replace API keys and database passwords with placeholders: .env.example, for example, should contain variable names and instructions only. Store actual secrets in the deployment platform's secret settings or server environment variables.