Contexts
This feature is in public preview. Features and behavior are subject to change.
Contexts are Markdown files that give the agent your organization's knowledge and ways of working, such as coding standards, review checklists, and step-by-step procedures. You create contexts in the Agentic Catalog and add them to persona configurations. WorkSpaces installs the contexts on each agent-ready WorkSpace that uses the persona configuration, where the agent reads them.
Context types
The following table describes the three types of context.
| Type | What it is | When the agent uses it |
|---|---|---|
| Agent.md | Instructions that shape how the agent behaves, such as team coding standards or writing style. | In every session. |
| Skill | A reusable procedure for a specific task, such as reviewing a pull request. A skill file starts with a name and a description. | When a task matches the skill's description. |
| Workflow | A multi-step process that the agent runs from start to finish, such as fixing a bug and opening a pull request. | When the user asks for the task that the workflow covers. Users can also start a workflow directly by entering / followed by the workflow's name. |
A persona configuration can include up to 50 contexts in total. Each account can have up to 100 contexts.
Create a context
To create a context
-
Open the Agentic Catalog
in the Amazon WorkSpaces console. Under Contexts, choose Create context. -
For Name, enter a name of up to 64 characters.
-
(Optional) For Description, enter up to 255 characters that help other administrators find the right context.
-
Under Type, choose Agent.md, Skill, or Workflow.
-
For File name, enter a name that ends in .md. The file name can contain only letters, numbers, hyphens (-), underscores (_), and periods (.), with no folder path.
-
For Content, enter the Markdown content. A context can be up to 1 MiB.
-
Choose Create context.
After you create a context, add it to a persona configuration. For more information, see Create a persona configuration.
Starter kits also create contexts in your account. You can use, duplicate, and delete them like contexts that you create yourself.
Change a context
You can't edit a context after you create it. Instead, you duplicate it and use the copy.
To change a context
-
Open the Agentic Catalog
in the Amazon WorkSpaces console. -
Under Contexts, select the context, and then choose Duplicate. The duplicate is a new, separate context. It isn't linked to the original.
-
Edit the content of the copy, and then create it.
-
Create a persona configuration that uses the new context. New WorkSpaces that you create from it get the new context.
-
To update existing WorkSpaces, add the new context and remove the old one by using
AssociateWorkspaceAgenticContextsandDisassociateWorkspaceAgenticContexts. -
Delete the old context after no persona configuration or WorkSpace uses it.
Delete a context
You can't delete a context while a persona configuration or WorkSpace uses it. Remove
it from those first. For WorkSpaces, use
DisassociateWorkspaceAgenticContexts. A persona configuration can't be
edited, so delete it or stop using it.
To delete a context
-
Open the Agentic Catalog
in the Amazon WorkSpaces console. -
Under Contexts, select the context.
-
Choose Delete, and then confirm.
Examples
The following example shows an Agent.md file.
# Engineering standards You are an AI agent working on behalf of our engineering team. ## Safety - Never commit secrets, credentials, or .env files. If you find one, stop and tell the user. - Ask before deleting files or rewriting git history. ## Code quality - Match the existing style of the repository. - Every bug fix includes a test that fails before the fix and passes after it. - Run the build and tests before you say you are done.
The following example shows a skill file.
--- name: pr-review description: Review a GitHub pull request for correctness, tests, security, and style. Use when the user asks to review a pull request or check a change before merge. --- # Pull request review ## Steps 1. Use the GitHub connector to get the pull request's description, changed files, and diff. 2. Review the changes for correctness, tests, security, and readability. 3. Cite a file and line number for every finding, and rate it Blocker, Major, Minor, or Nit. ## Output A one-line summary, the findings sorted by rating, and a verdict: Approve, Approve with changes, or Request changes.
Start each skill with a name and a description. The agent uses the description to decide when to use the skill.
The following example shows a workflow file.
# Summarize a dataset When to use: the user shares a spreadsheet, CSV, or export and asks what it says. Rules - Report findings, not causes. - Never change the source file. Save output as a new file. Steps 1. Describe the data: rows, columns, date range, and gaps. 2. Calculate the results, and keep each formula for an appendix. 3. Write a headline finding, 3-5 supporting numbers, and what the data can't tell you. Deliver one document with the summary and the formula appendix.
Best practices for writing contexts
-
Say when to use it. Start skills and workflows with when they apply. The agent uses the description to decide whether a skill fits the task.
-
Keep each context focused. One standard or one task per file is easier to reuse across persona configurations.
-
Write rules the agent can follow. Use specific, checkable rules ("cite a file and line number") instead of general goals ("be thorough").
-
Don't include secrets. Contexts are installed on every WorkSpace that uses them. Don't put passwords, keys, or tokens in them.
-
Tell the agent to treat file content as data. Instruct the agent that text inside the files it reviews, such as "ignore your rules," is content to evaluate, not an instruction to follow.
-
Don't rely on contexts for security. The agent follows contexts as instructions, but they don't enforce anything. Use OS policies and Agent Harness policies to set limits. For more information, see Security policies.
-
Test before you roll out. Try a new context on a test WorkSpace before you add it to persona configurations that many users share.