{
  "format": "ai-knowledge-map/tutorial-v1",
  "canonical": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/",
  "language": "en",
  "title": "II. How to build an agent",
  "summary": "Start with a topic assistant, add a knowledge base, cross-conversation memory and voice, then configure scheduled or event-triggered background tasks. Review publishing, maintenance and licensing.",
  "questions": [
    {
      "question": "How can I build an assistant that uses my own knowledge base?",
      "answer": "Define the audience, source material and permitted work, configure instructions and a knowledge base, then check answers with a small, verifiable task.",
      "sections": [
        {
          "id": "course-agent-building-topic-1",
          "title": "1. Build a topic assistant with a knowledge base",
          "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-1"
        }
      ]
    },
    {
      "question": "How can I add cross-conversation memory and voice to an agent?",
      "answer": "Choose how memory is stored and updated, then connect voice input and output. Consider external memory when information must be shared across devices or agents.",
      "sections": [
        {
          "id": "course-agent-building-topic-2",
          "title": "2. Build a voice agent with memory",
          "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
        }
      ]
    },
    {
      "question": "How should I configure background tasks, unattended execution and publication?",
      "answer": "Specify the schedule or event, scope and delivery, and check unattended permissions and failure handling. Distinguish publishing an assistant, reusable configuration and source code.",
      "sections": [
        {
          "id": "course-agent-building-topic-3",
          "title": "3. Build an agent that runs automatically in the background",
          "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
        },
        {
          "id": "course-agent-building-topic-4",
          "title": "4. Publish and maintain an agent",
          "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
        }
      ]
    }
  ],
  "scope": "Summary and short answers are derived from the canonical chapter. Original source labels, setup details, version context and testing limitations are retained in the complete sections below. This is a public reading format, not an independent review or test result.",
  "sources": [
    {
      "url": "https://support.claude.com/en/articles/11817273-use-claude-s-chat-search-and-memory-to-build-on-previous-context",
      "title": "Claude&#39;s memory guide",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Memory",
      "title": "WorkBuddy&#39;s memory guide",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://learn.chatgpt.com/docs/customization/memories",
      "title": "OpenAI&#39;s memory guide",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://code.claude.com/docs/en/memory",
      "title": "Claude Code&#39;s memory guide",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://learn.chatgpt.com/docs/features/voice",
      "title": "OpenAI&#39;s voice guide",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://support.claude.com/en/articles/11101966-use-voice-mode",
      "title": "Claude&#39;s voice guide",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://elevenlabs.io/",
      "title": "ElevenLabs",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://elevenlabs.io/docs/eleven-agents/customization/conversation-flow",
      "title": "Conversation flow configuration",
      "section": "course-agent-building-topic-2",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2"
    },
    {
      "url": "https://learn.chatgpt.com/docs/automations",
      "title": "OpenAI&#39;s scheduling guide",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Automation-Guide",
      "title": "WorkBuddy&#39;s scheduling guide",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/automations#trigger-tasks-from-app-events",
      "title": "OpenAI&#39;s event trigger guide",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger",
      "title": "n8n Schedule Trigger",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/use-chatgpt#choose-cloud-or-local-work",
      "title": "Cloud and local Work",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/enterprise/cloud-local-access",
      "title": "Local access",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/dots/getting-started",
      "title": "Getting started",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/dots/tasks-and-memory",
      "title": "tasks and memory",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/deploy/use-n8n-cloud.md",
      "title": "n8n Cloud",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Setting",
      "title": "WorkBuddy settings",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://www.workbuddy.cn/docs/workbuddyapp/features/Multidevice",
      "title": "lock-screen operation",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/long-running-work",
      "title": "Long-running work",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://code.claude.com/docs/en/how-claude-code-works#when-context-fills-up",
      "title": "Claude Code context",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://learn.chatgpt.com/docs/developer-commands#keep-transcripts-lean-with-compact",
      "title": "OpenAI&#39;s command guide",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://www.anthropic.com/research/effective-context-engineering-for-ai-agents",
      "title": "Anthropic&#39;s context engineering practices",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://www.anthropic.com/research/effective-harnesses-for-long-running-agents",
      "title": "Long-running agent harnesses",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/build/understand-workflows/workflow-components/work-with-nodes.md#node-settings",
      "title": "n8n node settings",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/build/manage-workflows/configure-workflow-settings.md#timeout-workflow",
      "title": "Workflow timeout",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/tools-agent#max-iterations",
      "title": "agent iterations",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Automation-Guide#结果通知",
      "title": "Notification guide",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/build/flow-logic/handle-errors-gracefully.md",
      "title": "Error handling",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.errortrigger",
      "title": "Error Trigger testing conditions",
      "section": "course-agent-building-topic-3",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3"
    },
    {
      "url": "https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository",
      "title": "GitHub&#39;s licensing guide",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://choosealicense.com/licenses/mit/",
      "title": "MIT license and explanation",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://www.apache.org/licenses/LICENSE-2.0",
      "title": "Apache-2.0, sections 3, 4 and 6",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://opensource.org/license/gpl-3.0",
      "title": "GPL-3.0, sections 1, 5 and 6",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://choosealicense.com/licenses/gpl-3.0/",
      "title": "GPL definitions and section 2",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://opensource.org/license/agpl-3.0",
      "title": "AGPL-3.0, section 13 and corresponding source",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://choosealicense.com/licenses/agpl-3.0/",
      "title": "AGPL license and explanation",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://opensource.org/osd",
      "title": "Open Source Definition",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    },
    {
      "url": "https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository",
      "title": "Adding a license",
      "section": "course-agent-building-topic-4",
      "context": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4"
    }
  ],
  "sections": [
    {
      "id": "course-agent-building-introduction",
      "title": "Introduction",
      "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-introduction",
      "html": "<p>There are usually three starting points:</p>\n<ul><li>Start with a blank project and add the capabilities you need.</li><li>Modify an existing template.</li><li>Describe your requirements in natural language and let the platform generate a first version.</li></ul>\n<p>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.</p>\n<p>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&#39;s time, fees and eligibility, for example. Once those answers pass inspection, consider connecting registration or personal-record tools.</p>\n<p>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.</p>"
    },
    {
      "id": "course-agent-building-topic-1",
      "title": "1. Build a topic assistant with a knowledge base",
      "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-1",
      "html": "<h3 id=\"course-agent-building-topic-1-heading-1\">1.1 Create a dedicated assistant in a platform: ChatGPT</h3>\n<p>Open ChatGPT on the web, click the three dots on the left and select GPTs.<br>Click Create at the upper right, then choose to create a plugin or a GPT; the latter option is being phased out.</p>\n<table class=\"d-table\"><thead><tr><th>Setting</th><th>What to provide</th></tr></thead><tbody><tr><td>Name and description</td><td>Core purpose, audience, tone and answer depth.</td></tr><tr><td>Instructions</td><td>Functions, scope, operating limits and examples: what users provide, what results look like and what to do with missing information.</td></tr><tr><td>Conversation starters</td><td>Show what users can ask; examples in the instructions show how to answer.</td></tr><tr><td>Knowledge</td><td>Data sources, existing materials and the purpose of each source.</td></tr><tr><td>Tools</td><td>Enable the required capabilities; configure connections for external services.</td></tr></tbody></table>\n<p>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&#39;s look at instructions, conversation starters, knowledge and tools.</p>\n<h4 id=\"course-agent-building-topic-1-heading-2\">Instructions</h4>\n<h5 id=\"course-agent-building-topic-1-heading-3\">I. Functions</h5>\n<ol><li>Start each task description with a verb.</li><li>Specify required materials, distinguishing essential from optional inputs for each task.</li><li>Describe the processing steps for each task.</li><li>Define deliverables that can be checked.</li></ol>\n<h5 id=\"course-agent-building-topic-1-heading-4\">II. Scope</h5>\n<ol><li>Define the subject scope, as with functions.</li><li>Define action boundaries: what may change, what must not happen and what requires confirmation.</li></ol>\n<h5 id=\"course-agent-building-topic-1-heading-5\">III. Operating limits</h5>\n<p>Specify what to do in each situation: ask a question, use a default or mark information as unspecified. Common situations include:</p>\n<ol><li>Missing information that determines the result.</li><li>Required facts absent from the materials.</li><li>Conflicting source conclusions.</li><li>Tool failures.</li><li>Missing preferences with little effect on the result.</li><li>Task completed, task incomplete or attempts unsuccessful.</li></ol>\n<h5 id=\"course-agent-building-topic-1-heading-6\">IV. Examples</h5>\n<p>Provide common user questions and examples of good replies.</p>\n<p>Examples should teach the model:</p>\n<ol><li>How to complete a normal task.</li><li>When to ask and when to continue.</li><li>How to handle easily confused requirements.</li><li>How to resolve conflicts.</li><li>How to use tools.</li></ol>\n<p>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.</p>\n<p>Some examples use special markers:</p>\n<p><code>&lt;examples&gt;</code> and <code>&lt;/examples&gt;</code> mark the beginning and end of a group.</p>\n<p><code>&lt;input&gt;</code> and <code>&lt;output&gt;</code> distinguish user input from an ideal reply.</p>\n<p>Ordinary prose works too.</p>\n<h4 id=\"course-agent-building-topic-1-heading-7\">Conversation starters</h4>\n<p>These appear when a user starts, showing how to prompt the assistant and indirectly communicating its main function.</p>\n<p>Good starters are:</p>\n<ol><li>Short.</li><li>Based on real user questions.</li><li>Clear about the action and its object.</li><li>Limited to existing capabilities.</li><li>Based on data the assistant can access or the user can later provide.</li></ol>\n<p>Usually prepare at least three starters.</p>\n<h4 id=\"course-agent-building-topic-1-heading-8\">Knowledge</h4>\n<p>You can describe sources, available materials and their purposes in one passage.</p>\n<p>For each source, include its name, version, access method and applicable scope.</p>\n<p>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.</p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-1-heading-9\">Tools</h4>\n<p>In ChatGPT&#39;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.</p>\n<p>If Actions is missing, Apps may be selected, or you may not yet have spoken to the builder&#39;s agent. Actions and the recommended model appear after the first exchange.</p>\n<p>Add credit with the tool provider where required, then connect the API key to the agent. If you cannot find the provider&#39;s API key page, ask AI to locate it.</p>\n<p>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.</p>\n<h3 id=\"course-agent-building-topic-1-heading-10\">1.2 Configure knowledge for an existing agent</h3>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-1-heading-11\">I. Global and project AGENTS.md files</h4>\n<p><code>AGENTS.md</code> is a common instruction file for agents; capitalization matters. For Codex-backed chats, global instructions in <code>~/.codex/AGENTS.md</code> can specify preferences and rules across projects. Other products have similar mechanisms: Claude Code uses <code>~\\.claude\\CLAUDE.md</code>. These files load at startup.</p>\n<p>For an individual project, add a project-specific <code>AGENTS.md</code>. Explain how to use its knowledge base and when to load each source, avoiding unnecessary reading and token use for every question.</p>\n<p>The instruction file also takes context space. Keep it concise, clear and internally consistent. Store complex information and long procedures in separate files.</p>\n<h4 id=\"course-agent-building-topic-1-heading-12\">II. Let the agent read a local materials directory</h4>\n<p>Using Codex as an example:</p>\n<ol><li>Organize related materials in a folder, or add a materials subfolder to an existing project.</li><li>Select that folder as the current project or working directory in Codex.</li><li>Give file or directory paths in the task and explain their purpose.</li><li>Save ongoing rules in the root <code>AGENTS.md</code>; add them to the existing file if there is one.</li></ol>\n<p>For example, keep product manuals separate from writing examples:</p>\n<pre><code class=\"language-text\">knowledge/\n├── AGENTS.md\n├── product/\n│   ├── manual.md\n│   └── faq.md\n└── writing/\n    └── examples.md</code></pre>\n<p>In <code>AGENTS.md</code>, write:</p>\n<pre><code class=\"language-text\">For questions about product features and operations, first consult product/manual.md.\nUse writing/examples.md for style; do not transfer its specific facts to new tasks.\nCite the source file and section in answers.\nKnowledge-answering tasks in this project only read files. Editing source materials requires an explicit update request.</code></pre>\n<p>Some older platform versions cannot directly read materials nested in subfolders. Check that the intended files are accessible.</p>\n<h4 id=\"course-agent-building-topic-1-heading-13\">III. Connect external documents, knowledge bases or databases</h4>\n<p>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.</p>\n<h5 id=\"course-agent-building-topic-1-heading-14\">Document libraries</h5>\n<table class=\"d-table\"><thead><tr><th>Preparation</th><th>Details</th><th>Usual provider</th></tr></thead><tbody><tr><td>Access account</td><td>An organizational account that can read the materials.</td><td>Organization administrator.</td></tr><tr><td>Connection</td><td>An existing connector or an organization-provided MCP/API.</td><td>Find it yourself; ask technical staff if unavailable.</td></tr><tr><td>Usage instructions</td><td>Purpose of each source, valid versions and citation requirements.</td><td>You and the business owner.</td></tr><tr><td>Test questions</td><td>Questions with known answers and matching source passages.</td><td>You.</td></tr></tbody></table>\n<h5 id=\"course-agent-building-topic-1-heading-15\">Business databases</h5>\n<h6 id=\"course-agent-building-topic-1-heading-16\">Step 1: Tell technical staff what you need to query</h6>\n<p>Instead of just asking to connect the database, provide a request such as:</p>\n<blockquote class=\"quote\"><p>I need the agent to check order status and calculate paid sales by date and region.</p>\n<p>Please provide the allowed data scope, read-only access method, field definitions and calculation rules, plus test questions for verifying results.</p>\n<p>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.</p></blockquote>\n<p>Technical staff can choose between two approaches:</p>\n<ul><li>For fixed tasks, provide dedicated tools such as order lookup or sales totals, with order IDs, dates and other parameters.</li><li>For flexible analysis, provide a SQL tool that lets the agent inspect permitted schemas and generate queries.</li></ul>\n<h6 id=\"course-agent-building-topic-1-heading-17\">Step 2: Connect the query tool to the agent</h6>\n<p>For a remote MCP service, follow the service connection steps. Database credentials can stay on the organization&#39;s server while you sign in with your organizational account.</p>\n<p>If direct local access is permitted, existing tools are available. Google&#39;s open-source MCP Toolbox for Databases, for example, supports PostgreSQL and other databases; consult the official PostgreSQL integration tutorial.</p>\n<p>For PostgreSQL, technical staff first need to:</p>\n<ol><li>Install Toolbox and locate its executable.</li><li>Prepare a read-only database account.</li><li>Set the database host, port, database name, username and password in the execution environment.</li><li>Verify network access and encrypted connection settings.</li></ol>\n<p>Enforce read-only access through the database account or server, then verify the connection with a small test.</p>"
    },
    {
      "id": "course-agent-building-topic-2",
      "title": "2. Build a voice agent with memory",
      "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-2",
      "html": "<h3 id=\"course-agent-building-topic-2-heading-1\">2.1 Configure memory across conversations</h3>\n<p>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.</p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-2-heading-2\">I. Use built-in memory</h4>\n<p>If you mainly use one product, check its built-in memory first. You usually do not need another database or service API.</p>\n<h5 id=\"course-agent-building-topic-2-heading-3\">Claude: Enable and manage memory in settings</h5>\n<ol><li>Open <strong>Settings → Your Claude</strong> and enable <strong>Memory from chats</strong>. Some interfaces still use <strong>Settings → Memory</strong>.</li><li>State what to retain, for example: “Remember that when I learn new software, I prefer concrete steps before explanations.”</li><li>Open <strong>Your memory → Manage</strong> to inspect topics; select an item to read, edit or delete it.</li><li>Ask it to correct or forget changed information, then check the record.</li></ol>\n<p>Claude projects also have their own memory. <strong>Use account memory</strong> in project memory settings controls whether account memory is included. Information stored in one project is not necessarily used in every project. <a href=\"https://support.claude.com/en/articles/11817273-use-claude-s-chat-search-and-memory-to-build-on-previous-context\" target=\"_blank\" rel=\"noopener noreferrer\">Claude&#39;s memory guide</a></p>\n<h5 id=\"course-agent-building-topic-2-heading-4\">WorkBuddy: Enable conversation memory generation</h5>\n<p>Click your avatar, open <strong>Settings → Memory</strong> and check that conversation memory generation is enabled. Open a generated record to read it; use the edit icon to request changes through conversation.</p>\n<p>WorkBuddy&#39;s documentation says it summarizes the day&#39;s conversations each night. A newly stated fact may not appear immediately, so account for this delay when checking it. <a href=\"https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Memory\" target=\"_blank\" rel=\"noopener noreferrer\">WorkBuddy&#39;s memory guide</a></p>\n<h5 id=\"course-agent-building-topic-2-heading-5\">ChatGPT: Enable local memory</h5>\n<p>Open <strong>Settings → Personalization</strong> and enable <strong>Enable Codex memories</strong>. Enter <code>/memories</code> 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 <strong>Allow memories from tool-assisted chats</strong>.</p>\n<p>These memories are organized in the background and may not appear immediately. They use separate storage from account memory on ChatGPT&#39;s website. Check separately when moving to the web or another computer; signing into the same account does not by itself establish shared storage. <a href=\"https://learn.chatgpt.com/docs/customization/memories\" target=\"_blank\" rel=\"noopener noreferrer\">OpenAI&#39;s memory guide</a></p>\n<h4 id=\"course-agent-building-topic-2-heading-6\">II. Save and update memory in files</h4>\n<p>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.</p>\n<h5 id=\"course-agent-building-topic-2-heading-7\">Step 1: Create a fixed memory file</h5>\n<p>Create <code>memory.md</code> in an accessible working directory. Start with three categories:</p>\n<pre><code class=\"language-markdown\"># User preferences\n\n# Confirmed background information\n\n# Ongoing work</code></pre>\n<p>This filename is a convention you choose. Naming a file <code>memory.md</code> does not make every agent read it automatically.</p>\n<h5 id=\"course-agent-building-topic-2-heading-8\">Step 2: Define reading and writing in persistent instructions</h5>\n<p>Add the actual path and usage rules to the project instruction file from the previous section. Adapt this example:</p>\n<pre><code class=\"language-text\">The memory file is memory.md in the current project root.\n\nAt the start of each new chat, read it and use information relevant to the task.\nUpdate it when I explicitly say &quot;remember,&quot; or confirm that a preference should continue to apply.\nRecord only information I have confirmed. Do not store guesses, examples or undecided options as facts.\nGive each entry a confirmation date. For temporary items, include the applicable period or completion status.\nWhen information changes, update the existing entry rather than keeping contradictory current versions.\nDelete the relevant entry when I ask you to forget it.\nReport that information is saved only after a successful write. Explain if write permission is unavailable.</code></pre>\n<p>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.</p>\n<p>Some products already maintain memory files automatically. Claude Code enables automatic memory by default in ordinary local sessions; use <code>/memory</code> 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. <a href=\"https://code.claude.com/docs/en/memory\" target=\"_blank\" rel=\"noopener noreferrer\">Claude Code&#39;s memory guide</a></p>\n<h4 id=\"course-agent-building-topic-2-heading-9\">III. Connect an external memory service</h4>\n<p>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&#39; built-in memory separately does not connect them.</p>\n<p>Mem0, for example, provides tools to save, search, update and delete memories, with MCP support.</p>\n<h4 id=\"course-agent-building-topic-2-heading-10\">IV. Decide what memory should retain</h4>\n<p>Define how to handle these categories:</p>\n<ol><li><strong>Long-term preferences:</strong> Distinguish “keep today&#39;s answer short” from “use short answers by default from now on.”</li><li><strong>Personal background:</strong> Retain confirmed facts useful to later tasks. Do not infer profession, personality or identity from one question.</li><li><strong>Ongoing work:</strong> Record progress, confirmed decisions and next steps; update the status when finished.</li><li><strong>Expiring information:</strong> Record applicable dates or conditions and reconfirm before use when necessary.</li><li><strong>Excluded information:</strong> Passwords, API keys and anything the user explicitly limits to the current conversation.</li></ol>\n<p>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.</p>\n<h3 id=\"course-agent-building-topic-2-heading-11\">2.2 Configure voice interaction</h3>\n<p>For a continuous, call-like exchange in which the agent listens and speaks, you need full voice conversation support.</p>\n<h4 id=\"course-agent-building-topic-2-heading-12\">I. Enable an existing assistant&#39;s voice mode</h4>\n<h5 id=\"course-agent-building-topic-2-heading-13\">ChatGPT desktop</h5>\n<ol><li>Open the chat or Codex task you want to continue.</li><li>Click <strong>Start voice chat</strong>, or <strong>Start new voice chat</strong> for a new conversation.</li><li>Allow microphone access and choose a voice on first use.</li><li>Speak, then click <strong>Stop voice chat</strong> to finish. You can set a shortcut in <strong>Settings → Voice → Voice chat hotkey</strong>.</li></ol>\n<p>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. <a href=\"https://learn.chatgpt.com/docs/features/voice\" target=\"_blank\" rel=\"noopener noreferrer\">OpenAI&#39;s voice guide</a></p>\n<h5 id=\"course-agent-building-topic-2-heading-14\">Claude</h5>\n<ol><li>Open a chat on the web or in Claude Desktop and click the waveform near the input box. Mobile uses the waveform too.</li><li>Allow microphone access. On mobile, choose a voice at first use; later adjust voice and speed in voice settings.</li><li>Speak continuously in a quiet environment. In noisy surroundings, use <strong>Push-to-talk</strong>: hold to speak and release to send.</li></ol>\n<p>Claude can switch between text and voice in the same conversation while preserving context. Type URLs, names and other easily misheard details when useful. <a href=\"https://support.claude.com/en/articles/11101966-use-voice-mode\" target=\"_blank\" rel=\"noopener noreferrer\">Claude&#39;s voice guide</a></p>\n<h4 id=\"course-agent-building-topic-2-heading-15\">II. Build a dedicated assistant on a voice platform</h4>\n<p>Choose a voice-building platform when you want to configure the voice, opening message and waiting time separately and share the assistant with others. <strong>ElevenLabs Agents</strong>, for example, provides web configuration, a test interface and website widgets.</p>\n<h5 id=\"course-agent-building-topic-2-heading-16\">Step 1: Create the assistant and reuse your task configuration</h5>\n<p>Sign in to <a href=\"https://elevenlabs.io/\" target=\"_blank\" rel=\"noopener noreferrer\">ElevenLabs</a>, open the Agents console, create an assistant and select <strong>Blank template</strong>.</p>\n<p>On the <strong>Agent</strong> page, fill in:</p>\n<ul><li><strong>System prompt:</strong> Use section 1.1 to define tasks, scope and handling rules. Start with your existing instructions, adding the voice-specific requirements below.</li><li><strong>First message:</strong> 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.</li></ul>\n<h5 id=\"course-agent-building-topic-2-heading-17\">Step 2: Configure language, voice and speed</h5>\n<p>Choose a voice and adjust Speed on the <strong>Voice</strong> page.</p>\n<h5 id=\"course-agent-building-topic-2-heading-18\">Step 3: Configure turn-taking and interruption</h5>\n<p>Find <strong>Turn eagerness</strong> in agent settings and start with <strong>Normal</strong>. Choose <strong>Patient</strong> if users often need time to think or form longer sentences.</p>\n<p>To let users interrupt, check <code>interruption</code> under <strong>Advanced → Client Events</strong>. Configure waiting and interruption behavior in the actual settings; “do not interrupt me” in the prompt is insufficient. <a href=\"https://elevenlabs.io/docs/eleven-agents/customization/conversation-flow\" target=\"_blank\" rel=\"noopener noreferrer\">Conversation flow configuration</a></p>\n<h4 id=\"course-agent-building-topic-2-heading-19\">III. Add voice services to your application or existing agent</h4>\n<p>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.</p>\n<pre><code class=\"language-text\">Agent generates a final answer\n        ↓\nProgram obtains the answer text\n        ↓\nBackend calls a service such as ElevenLabs with text, voice ID and model\n        ↓\nElevenLabs returns audio\n        ↓\nBackend sends the audio to the current user&#39;s page\n        ↓\nThe page&#39;s player plays it</code></pre>"
    },
    {
      "id": "course-agent-building-topic-3",
      "title": "3. Build an agent that runs automatically in the background",
      "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-3",
      "html": "<h3 id=\"course-agent-building-topic-3-heading-1\">3.1 Scheduled and event-triggered execution</h3>\n<h4 id=\"course-agent-building-topic-3-heading-2\">I. Ask an existing assistant to create a scheduled task</h4>\n<h5 id=\"course-agent-building-topic-3-heading-3\">Specify when it runs and what it does each time</h5>\n<p>You can ask through conversation without learning scheduling expressions first. Replace the brackets with your task details:</p>\n<pre><code class=\"language-text\">Create a scheduled task.\nSchedule: [one-time date, or frequency, exact time and time zone].\nWork each run: [the task to execute].\nSources: [files, project, connected services or specified sites].\nScope: [objects to process, or the time period to cover].\nDeliverable: [output, save location or notification method].\nIf nothing matches: [end the run, record &quot;no updates,&quot; or another agreed action].</code></pre>\n<p>“Remind me to prepare a weekly report” and “read this week&#39;s records and write the report” are different requests. Include the actual work if you want it performed, rather than just a reminder.</p>\n<h5 id=\"course-agent-building-topic-3-heading-4\">ChatGPT: Create in chat, then check Scheduled</h5>\n<p>Describe the schedule and specify whether future runs should continue in the current conversation or run separately. After creation, open <strong>Scheduled</strong> to check the saved instructions, execution time and status.</p>\n<p>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. <a href=\"https://learn.chatgpt.com/docs/automations\" target=\"_blank\" rel=\"noopener noreferrer\">OpenAI&#39;s scheduling guide</a></p>\n<h5 id=\"course-agent-building-topic-3-heading-5\">WorkBuddy: Create in chat or Scheduled tasks</h5>\n<p>Describe a recurring need in ordinary chat, or open <strong>Scheduled tasks → arrow beside New → Create from task</strong>, add the requirements and send.</p>\n<p>For manual setup, select <strong>Scheduled tasks → New</strong> and fill in:</p>\n<ol><li><strong>Name and prompt:</strong> Task name and work for each run.</li><li><strong>Model, expert, skills and connectors:</strong> Required capabilities.</li><li><strong>Workspace:</strong> The execution directory for local files.</li><li><strong>Repeat, time and validity:</strong> One-time or recurring rule, execution time and effective period.</li></ol>\n<p>After saving, check the card&#39;s next execution time and use Run for a test. Inspect results in run history. Pause future runs with the card&#39;s switch when no longer needed; this does not interrupt an already-started run.</p>\n<p>Local tasks depend on the computer and client. Cloud tasks run remotely but cannot directly access local files. <a href=\"https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Automation-Guide\" target=\"_blank\" rel=\"noopener noreferrer\">WorkBuddy&#39;s scheduling guide</a></p>\n<h4 id=\"course-agent-building-topic-3-heading-6\">II. Use built-in event triggers</h4>\n<p>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.</p>\n<p>Eligible ChatGPT accounts can create Gmail, Slack and GitHub event tasks on the web or mobile; creation is not available on desktop.</p>\n<p>Connect and authorize the application, then ask:</p>\n<pre><code class=\"language-text\">Create an event-triggered task.\nEvent source: [account, channel or repository].\nTrigger: [new events to handle and filtering conditions].\nWork each run: [what to do with the received content].\nDeliverable: [save location and when to notify me].</code></pre>\n<p>Check the task in <strong>Scheduled</strong>. Availability depends on plan and workspace settings. A task cannot use both an event trigger and a time schedule. <a href=\"https://learn.chatgpt.com/docs/automations#trigger-tasks-from-app-events\" target=\"_blank\" rel=\"noopener noreferrer\">OpenAI&#39;s event trigger guide</a></p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-7\">III. Use an automation platform when built-in triggers are insufficient</h4>\n<p>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.</p>\n<p>You can use n8n Cloud to avoid local installation, or an existing organizational instance, which may require Docker. Begin with the shortest workflow:</p>\n<pre><code class=\"language-text\">Scheduled or event trigger → Agent processing → Save results or notify</code></pre>\n<p>Add a trigger node to a new workflow. A node is a step in the process.</p>\n<p><strong>For scheduled runs, add Schedule Trigger.</strong></p>\n<p>Add a rule under <strong>Trigger Rules</strong>, choose days, weeks, hours or another unit in <strong>Trigger Interval</strong>, then set the time. Check the workflow&#39;s time zone rather than assuming the server uses yours. Save and publish the workflow to activate its schedule. <a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger\" target=\"_blank\" rel=\"noopener noreferrer\">n8n Schedule Trigger</a></p>\n<p><strong>For event triggers, select the application&#39;s Trigger node.</strong></p>\n<p>For email, add <strong>Gmail Trigger</strong>:</p>\n<ol><li>Create or select a Google connection in <strong>Credential to connect with</strong>. n8n Cloud supports <strong>Sign in with Google</strong> without configuring your own Google Cloud application.</li><li>Select <strong>Message Received</strong>.</li><li>Set the check frequency in <strong>Poll Times</strong>, with sender, label or search filters as needed.</li><li>Fetch one matching email in a test and inspect the node output.</li></ol>\n<h3 id=\"course-agent-building-topic-3-heading-8\">3.2 Keep it available around the clock</h3>\n<p>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.</p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-9\">I. Start with an existing cloud option</h4>\n<p>Use cloud execution if uploads, online documents, remote tools and APIs cover the task. Your computer need not stay on.</p>\n<h5 id=\"course-agent-building-topic-3-heading-10\">WorkBuddy: Run tasks in cloud mode</h5>\n<h5 id=\"course-agent-building-topic-3-heading-11\">ChatGPT: Choose a cloud environment for Work</h5>\n<p>Select <strong>Work</strong> on ChatGPT&#39;s website, or choose <strong>Cloud</strong> when creating a task in a supporting desktop client. Upload the materials, connect tools and state the task.</p>\n<p>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. <a href=\"https://learn.chatgpt.com/docs/use-chatgpt#choose-cloud-or-local-work\" target=\"_blank\" rel=\"noopener noreferrer\">Cloud and local Work</a></p>\n<p>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. <a href=\"https://learn.chatgpt.com/docs/enterprise/cloud-local-access\" target=\"_blank\" rel=\"noopener noreferrer\">Local access</a></p>\n<h5 id=\"course-agent-building-topic-3-heading-12\">For an ongoing responsibility</h5>\n<p>If your account has <strong>dots</strong>, 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.</p>\n<p>Create a dot, connect the applications it needs, then describe its ongoing goal, sources, deliverables and decisions that require you. Inspect individual tasks through <strong>Activity</strong>. Access to your own computer still needs a separate connection and an online computer. <a href=\"https://learn.chatgpt.com/docs/dots/getting-started\" target=\"_blank\" rel=\"noopener noreferrer\">Getting started</a>, <a href=\"https://learn.chatgpt.com/docs/dots/tasks-and-memory\" target=\"_blank\" rel=\"noopener noreferrer\">tasks and memory</a></p>\n<p>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. <a href=\"https://docs.n8n.io/deploy/use-n8n-cloud.md\" target=\"_blank\" rel=\"noopener noreferrer\">n8n Cloud</a></p>\n<h4 id=\"course-agent-building-topic-3-heading-13\">II. Keep a local computer running when its files and software are required</h4>\n<p>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.</p>\n<h5 id=\"course-agent-building-topic-3-heading-14\">Prevent sleep and configure background operation</h5>\n<p>For WorkBuddy desktop:</p>\n<ol><li>Keep the computer powered, online and signed in to WorkBuddy.</li><li>Under <strong>Settings → General → Permissions</strong>, enable the option to prevent sleep during execution. It prevents idle sleep while a local task runs, but the display may turn off.</li><li>For remote availability between tasks, find the lock-screen execution settings under <strong>Settings → General</strong>. Choose to stay awake after the display turns off, or keep the display on if needed.</li><li>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.</li></ol>\n<p>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. <a href=\"https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Setting\" target=\"_blank\" rel=\"noopener noreferrer\">WorkBuddy settings</a>, <a href=\"https://www.workbuddy.cn/docs/workbuddyapp/features/Multidevice\" target=\"_blank\" rel=\"noopener noreferrer\">lock-screen operation</a></p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-15\">III. Keep a long-running task progressing</h4>\n<p>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.</p>\n<h5 id=\"course-agent-building-topic-3-heading-16\">Use a product&#39;s persistent-goal feature first</h5>\n<p>For <strong>Goal mode</strong> in ChatGPT desktop or Codex, enter <code>/goal</code> and provide the goal, constraints and checkable completion criteria. Use the goal progress bar to pause, resume or change it.</p>\n<p>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. <a href=\"https://learn.chatgpt.com/docs/long-running-work\" target=\"_blank\" rel=\"noopener noreferrer\">Long-running work</a></p>\n<h5 id=\"course-agent-building-topic-3-heading-17\">Save actual progress</h5>\n<p>For your own agent, require a progress file or database update after each stage, including:</p>\n<ul><li>Completed work and output locations.</li><li>Current work and the last successful step.</li><li>Remaining tasks and known problems.</li></ul>\n<p>On restart, read and verify these records before continuing. Use the files or external storage from section 2.1, recording execution progress here.</p>\n<h5 id=\"course-agent-building-topic-3-heading-18\">Manage growing context</h5>\n<p>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.</p>\n<p><strong>1. Prefer built-in automatic compaction.</strong></p>\n<p>Compaction summarizes older conversation to free space. Claude Code compacts automatically near its context limit. Use <code>/context</code> to inspect usage or <code>/compact</code> to compact manually with a chosen focus.</p>\n<p>Add <strong>Compact Instructions</strong> to <code>CLAUDE.md</code> 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. <a href=\"https://code.claude.com/docs/en/how-claude-code-works#when-context-fills-up\" target=\"_blank\" rel=\"noopener noreferrer\">Claude Code context</a></p>\n<p>Codex CLI also provides <code>/compact</code> to replace older conversation with a short summary. This is a client-specific command, not a command for every chat product. <a href=\"https://learn.chatgpt.com/docs/developer-commands#keep-transcripts-lean-with-compact\" target=\"_blank\" rel=\"noopener noreferrer\">OpenAI&#39;s command guide</a></p>\n<p>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.</p>\n<p><strong>2. Read only what the current stage needs.</strong></p>\n<p>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.</p>\n<p>For many documents, save each document&#39;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. <a href=\"https://www.anthropic.com/research/effective-context-engineering-for-ai-agents\" target=\"_blank\" rel=\"noopener noreferrer\">Anthropic&#39;s context engineering practices</a></p>\n<p><strong>3. Continue in a fresh context after a stage.</strong></p>\n<p>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&#39;s long-running task practices use this staged approach too. <a href=\"https://www.anthropic.com/research/effective-harnesses-for-long-running-agents\" target=\"_blank\" rel=\"noopener noreferrer\">Long-running agent harnesses</a></p>\n<p>Add to project instructions:</p>\n<pre><code class=\"language-text\">Read only the materials required for the current stage. Save detailed results in output files.\nAt each stage&#39;s end, update progress with key decisions, evidence locations and the next step.\nAt a new session&#39;s start, read the task and latest progress, then verify existing outputs before continuing.\nIf a summary leaves a fact uncertain, check the original source instead of filling it in.</code></pre>\n<p>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.</p>\n<h3 id=\"course-agent-building-topic-3-heading-19\">3.3 Configure unattended behavior</h3>\n<p>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.</p>\n<p>Add handling rules to the task prompt or persistent instructions; in n8n, use the AI Agent&#39;s <strong>System Message</strong>. Configure permissions, approvals and timeouts in the software or tools as well.</p>\n<h4 id=\"course-agent-building-topic-3-heading-20\">I. Decide whether to continue, skip or pause when information is missing</h4>\n<p>Section 1.1 covered missing information and conflicting sources. Here, specify how a run ends when no user reply is immediately available.</p>\n<table class=\"d-table\"><thead><tr><th>Situation</th><th>Suitable action</th><th>What to specify</th></tr></thead><tbody><tr><td>Missing preferences that do not affect facts or actions, such as layout</td><td>Continue using agreed defaults.</td><td>Which defaults, and whether to mention them.</td></tr><tr><td>One independent batch record lacks essential fields</td><td>Skip it and process the rest.</td><td>Save its ID, missing information and unprocessed work.</td></tr><tr><td>Missing evidence determines the overall result, or the action target is uncertain</td><td>Stop dependent work.</td><td>Save completed outputs and list questions.</td></tr><tr><td>The user must choose, or a source conflict cannot be resolved</td><td>Mark pending and retain candidates.</td><td>Explain options, differences and the required decision.</td></tr></tbody></table>\n<p>For example:</p>\n<pre><code class=\"language-text\">This task runs unattended. Handle problems as follows:\nUse agreed defaults for missing wording or layout preferences; do not wait for these.\nIf one record lacks essential material, save its ID and reason, skip it, and continue only with independent records.\nIf the overall basis or action target is uncertain, stop related actions, save existing outputs and list questions.\nDo not count unprocessed, pending or failed items as completed.</code></pre>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-21\">II. Configure direct actions and human approval</h4>\n<h5 id=\"course-agent-building-topic-3-heading-22\">Enforce the required access scope</h5>\n<p>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.</p>\n<h5 id=\"course-agent-building-topic-3-heading-23\">Send a request when approval is needed</h5>\n<p>Human approval often suits external sending, changes to important business records, deletion and actions beyond agreed scope.</p>\n<p>In n8n, add approval for selected tools:</p>\n<ol><li>Click the <strong>AI Agent</strong> node&#39;s <strong>Tools</strong> connector to open the tool panel.</li><li>Under <strong>Human review</strong>, choose a channel such as Slack, Telegram or n8n Chat.</li><li>Configure channel credentials and the recipient or conversation.</li><li>Connect tools requiring approval to the human review step&#39;s tool connector. Connect other tools normally.</li></ol>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-24\">III. Limit retries and define stopping conditions for tool failures</h4>\n<p>Distinguish failure types rather than saying “keep trying”:</p>\n<ul><li><strong>Temporary network or service failures:</strong> Retry a limited number of times with specified intervals.</li><li><strong>Expired login, missing permissions or invalid input:</strong> Record the cause and stop the affected step until fixed.</li><li><strong>An action was submitted without a clear result:</strong> Check the actual state before deciding whether to retry.</li></ul>\n<p>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.</p>\n<p>In a node&#39;s <strong>Settings</strong>, configure <strong>Retry On Fail</strong> for suitable operations, with attempt and waiting limits. Use <strong>On Error → Stop Workflow</strong> to stop the process, or <strong>Continue (using error output)</strong> to route errors to a dedicated branch while independent work continues. <a href=\"https://docs.n8n.io/build/understand-workflows/workflow-components/work-with-nodes.md#node-settings\" target=\"_blank\" rel=\"noopener noreferrer\">n8n node settings</a></p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-25\">IV. Set limits for each run</h4>\n<p>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.</p>\n<p>In n8n:</p>\n<ol><li>Open the workflow&#39;s upper-right <strong>Settings</strong>, enable <strong>Timeout Workflow</strong> and set <strong>Timeout After</strong>.</li><li>Set <strong>Max Iterations</strong> in the <strong>AI Agent</strong> node options.</li><li>Set a maximum retrieval count where the data node supports it, leaving the rest for later runs.</li></ol>\n<p>Workflow timeout and agent iterations limit different scopes and cannot replace each other. n8n Cloud also imposes plan-specific maximum timeouts. <a href=\"https://docs.n8n.io/build/manage-workflows/configure-workflow-settings.md#timeout-workflow\" target=\"_blank\" rel=\"noopener noreferrer\">Workflow timeout</a>, <a href=\"https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/tools-agent#max-iterations\" target=\"_blank\" rel=\"noopener noreferrer\">agent iterations</a></p>\n<p>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.</p>\n<h4 id=\"course-agent-building-topic-3-heading-26\">V. Completed, pending and failed work</h4>\n<p>Section 3.1 configured output locations. Also define run status:</p>\n<ul><li><strong>Completed:</strong> Agreed items processed and results saved; verify delivery if required.</li><li><strong>Partially completed:</strong> Keep usable outputs and list skipped, failed and unprocessed items.</li><li><strong>Awaiting approval:</strong> State the proposed action, affected objects and required decision.</li><li><strong>Failed or pending verification:</strong> State the last successful step, error and place to investigate.</li></ul>\n<p>“Report generated, delivery failed” needs separate generation and delivery statuses rather than a single “completed.”</p>\n<p>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.</p>\n<p>For WorkBuddy local schedules, enable scheduled-task output notifications in <strong>Settings → General</strong>. Its mobile app can receive completion, approval and failure notifications from a linked computer. <a href=\"https://www.workbuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Automation-Guide#结果通知\" target=\"_blank\" rel=\"noopener noreferrer\">Notification guide</a></p>\n<p>In n8n, configure failure notifications separately:</p>\n<ol><li>Create a workflow starting with <strong>Error Trigger</strong>, followed by an email or message node with recipient and error summary.</li><li>Save it, then select it in the original workflow&#39;s <strong>Settings → Error workflow</strong>.</li><li>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. <a href=\"https://docs.n8n.io/build/flow-logic/handle-errors-gracefully.md\" target=\"_blank\" rel=\"noopener noreferrer\">Error handling</a>, <a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.errortrigger\" target=\"_blank\" rel=\"noopener noreferrer\">Error Trigger testing conditions</a></li></ol>"
    },
    {
      "id": "course-agent-building-topic-4",
      "title": "4. Publish and maintain an agent",
      "url": "https://ai-knowledge-map.com/en/software/agents-automation/agent-building/#course-agent-building-topic-4",
      "html": "<h3 id=\"course-agent-building-topic-4-heading-1\">4.1 Publish an agent</h3>\n<p>There are three kinds of publication:</p>\n<ul><li><strong>An assistant people use directly:</strong> Through a link, chat channel or API to your configured agent.</li><li><strong>A configuration people copy:</strong> Instructions, source guides or workflow templates imported into their accounts, with their own materials and connections.</li><li><strong>Source code people can modify and redistribute:</strong> Programs and licenses that let users modify, deploy or distribute them.</li></ul>\n<h4 id=\"course-agent-building-topic-4-heading-2\">I. Ownership: Establish what you may publish</h4>\n<p>Check who can authorize publication and which third-party materials you used.</p>\n<ol><li><strong>Your own or your team&#39;s work:</strong> 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.</li><li><strong>Third-party code, templates and assets:</strong> Find their licenses or permissions. Check modification, redistribution, commercial use and required notices.</li><li><strong>Knowledge-base materials:</strong> 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.</li></ol>\n<h4 id=\"course-agent-building-topic-4-heading-3\">II. Open-source licenses: Specify how others may use your work</h4>\n<p>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. <a href=\"https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub&#39;s licensing guide</a></p>\n<p>The main differences among these four licenses concern proprietary modifications and when source must be provided.</p>\n<h5 id=\"course-agent-building-topic-4-heading-4\">1. MIT: Allows modification, commercial use and proprietary versions</h5>\n<p>Consider MIT if you want easy reuse and accept others building paid, proprietary products from your code.</p>\n<ul><li><strong>Allowed:</strong> Copying, modifying, merging, distributing and selling the code, including within proprietary software without publishing added or changed source.</li><li><strong>Required:</strong> Retain the copyright and full license notice in copies or substantial portions. Proprietary distribution does not permit removing the original notices.</li><li><strong>Not required:</strong> Returning improvements to you or licensing the entire product under MIT.</li></ul>\n<p>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. <a href=\"https://choosealicense.com/licenses/mit/\" target=\"_blank\" rel=\"noopener noreferrer\">MIT license and explanation</a></p>\n<h5 id=\"course-agent-building-topic-4-heading-5\">2. Apache-2.0: Allows proprietary versions with explicit patent and modification rules</h5>\n<p>Consider Apache-2.0 if you accept proprietary products but want explicit treatment of contributors&#39; relevant patents. Compared with MIT, it adds:</p>\n<ul><li><strong>An explicit patent grant:</strong> 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.</li><li><strong>Patent-litigation consequences:</strong> Bringing specified patent litigation alleging infringement by the work or a contribution terminates the patent licenses granted for that work under the license.</li><li><strong>Modification notices:</strong> Distributed modified files need prominent change notices, alongside the license and applicable notices. Preserve applicable attribution from an original <code>NOTICE</code> file under the terms.</li><li><strong>No general trademark grant:</strong> A code license does not authorize using the project&#39;s name, trademarks or logo as your product&#39;s brand.</li></ul>\n<p>It permits proprietary modifications and does not require returning improvements. Its grants and notice rules are more detailed than MIT&#39;s. <a href=\"https://www.apache.org/licenses/LICENSE-2.0\" target=\"_blank\" rel=\"noopener noreferrer\">Apache-2.0, sections 3, 4 and 6</a></p>\n<h5 id=\"course-agent-building-topic-4-heading-6\">3. GPL-3.0: Preserve recipients&#39; access to source and modification rights when distributing</h5>\n<p>Consider GPL-3.0 if recipients of your program or covered modifications should be able to inspect, modify and redistribute the source.</p>\n<ul><li><strong>Charging is allowed:</strong> You may sell the program or charge for installation and maintenance, but cannot remove recipients&#39; GPL modification and redistribution rights through a fee agreement.</li><li><strong>Distribution requires corresponding source or an allowed way to obtain it:</strong> For example, offer matching source alongside an installer download. An old repository that does not match the distributed version is insufficient.</li><li><strong>Covered modifications cannot simply become proprietary:</strong> Distribution must license the whole covered work under the GPL, not just publish the few lines you changed.</li></ul>\n<p>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. <a href=\"https://opensource.org/license/gpl-3.0\" target=\"_blank\" rel=\"noopener noreferrer\">GPL-3.0, sections 1, 5 and 6</a></p>\n<p><strong>Private modification and use do not by themselves require publication.</strong> 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. <a href=\"https://choosealicense.com/licenses/gpl-3.0/\" target=\"_blank\" rel=\"noopener noreferrer\">GPL definitions and section 2</a></p>\n<h5 id=\"course-agent-building-topic-4-heading-7\">4. AGPL-3.0: Offer corresponding source to users of a modified network service too</h5>\n<p>Consider AGPL-3.0 for an agent server if you want others deploying modified websites or APIs to provide the modified source to users.</p>\n<p>It retains GPL-like distribution requirements and adds a network-service requirement: <strong>if you modify the program and users interact with that version over a network, prominently offer those users free access to its corresponding source.</strong> A service might provide a source download matching its deployed version.</p>\n<p>“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. <a href=\"https://opensource.org/license/agpl-3.0\" target=\"_blank\" rel=\"noopener noreferrer\">AGPL-3.0, section 13 and corresponding source</a></p>\n<p>AGPL permits commercial use and paid services. It governs source access and subsequent rights rather than prohibiting revenue. <a href=\"https://choosealicense.com/licenses/agpl-3.0/\" target=\"_blank\" rel=\"noopener noreferrer\">AGPL license and explanation</a></p>\n<p>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&#39;s definition. <a href=\"https://opensource.org/osd\" target=\"_blank\" rel=\"noopener noreferrer\">Open Source Definition</a></p>\n<p>To add a license on GitHub:</p>\n<ol><li>Open the repository and select <strong>Add file → Create new file</strong>.</li><li>Name it <code>LICENSE</code> and click <strong>Choose a license template</strong>.</li><li>Choose the applicable license and check the year, rights holder and other required fields.</li><li>Click <strong>Review and submit</strong>, then <strong>Commit changes</strong>.</li></ol>\n<p>In a local project, create <code>LICENSE</code> 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. <a href=\"https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository\" target=\"_blank\" rel=\"noopener noreferrer\">Adding a license</a></p>\n<h4 id=\"course-agent-building-topic-4-heading-8\">III. Describe the published work</h4>\n<p>For an online assistant, place usage instructions on its introduction page or near the entry point, usually in the root <code>README.md</code> for a project.</p>\n<p>For a copyable project, also provide installation, configuration and startup steps. Replace API keys and database passwords with placeholders: <code>.env.example</code>, for example, should contain variable names and instructions only. Store actual secrets in the deployment platform&#39;s secret settings or server environment variables.</p>"
    }
  ]
}
