|
| 1 | +# Migrating Profiles to Agents |
| 2 | + |
| 3 | +All global profiles (created under `~/.aws/amazonq/profiles/`) support automatic migration to the global agents directory under `~/.aws/amazonq/cli-agents/` on initial startup. |
| 4 | + |
| 5 | +If you have local MCP configuration defined under `.amazonq/mcp.json`, then you can optionally add this configuration to a global agent, or create a new workspace agent. |
| 6 | + |
| 7 | +## Creating a New Workspace Agent |
| 8 | + |
| 9 | +Workspace agents are managed under the current working directory inside `.amazonq/cli-agents/`. |
| 10 | + |
| 11 | +You can create a new workspace agent with `q agent create --name my-agent -d .`. |
| 12 | + |
| 13 | +## Global Context |
| 14 | + |
| 15 | +Global context previously configured under `~/.aws/amazonq/global_context.json` is no longer supported. Global context will need to be manually added to agents (see the below section). |
| 16 | + |
| 17 | +## MCP Servers |
| 18 | + |
| 19 | +The agent configuration supports the same MCP format as previously configured. |
| 20 | + |
| 21 | +See [the agent format documentation for more details](./agent-format.md#mcpservers-field). |
| 22 | + |
| 23 | +## Context Files |
| 24 | + |
| 25 | +Context files are now [file URI's](https://en.wikipedia.org/wiki/File_URI_scheme) and configured under the `"resources"` field. |
| 26 | + |
| 27 | +Example from profiles: |
| 28 | +```json |
| 29 | +{ |
| 30 | + "paths": [ |
| 31 | + "~/my-files/**/*.txt" |
| 32 | + ] |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +Same example for agents: |
| 37 | +```json |
| 38 | +{ |
| 39 | + "resources": [ |
| 40 | + "file://~/my-files/**/*.txt" |
| 41 | + ] |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +## Hooks |
| 46 | + |
| 47 | +Hook triggers have been updated: |
| 48 | +- Hook name is no longer required |
| 49 | +- `conversation_start` is now `agentSpawn` |
| 50 | +- `per_prompt` is now `userPromptSubmit` |
| 51 | + |
| 52 | +See [the agent format documentation for more details](./agent-format.md#hooks-field). |
| 53 | + |
| 54 | +Example from profiles: |
| 55 | +```json |
| 56 | +{ |
| 57 | + "hooks": { |
| 58 | + "sleep_conv_start": { |
| 59 | + "trigger": "conversation_start", |
| 60 | + "type": "inline", |
| 61 | + "disabled": false, |
| 62 | + "timeout_ms": 30000, |
| 63 | + "max_output_size": 10240, |
| 64 | + "cache_ttl_seconds": 0, |
| 65 | + "command": "echo Conversation start hook" |
| 66 | + }, |
| 67 | + "hello_world": { |
| 68 | + "trigger": "per_prompt", |
| 69 | + "type": "inline", |
| 70 | + "disabled": false, |
| 71 | + "timeout_ms": 30000, |
| 72 | + "max_output_size": 10240, |
| 73 | + "cache_ttl_seconds": 0, |
| 74 | + "command": "echo Per prompt hook" |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +Same example for agents: |
| 81 | +```json |
| 82 | +{ |
| 83 | + "hooks": { |
| 84 | + "userPromptSubmit": [ |
| 85 | + { |
| 86 | + "command": "echo Per prompt hook", |
| 87 | + "timeout_ms": 30000, |
| 88 | + "max_output_size": 10240, |
| 89 | + "cache_ttl_seconds": 0 |
| 90 | + } |
| 91 | + ], |
| 92 | + "agentSpawn": [ |
| 93 | + { |
| 94 | + "command": "echo Conversation start hook", |
| 95 | + "timeout_ms": 30000, |
| 96 | + "max_output_size": 10240, |
| 97 | + "cache_ttl_seconds": 0 |
| 98 | + } |
| 99 | + ] |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
0 commit comments