atlas-agent-engine
Skill8 starsChanged 26 days agoApache-2.0View on GitHub
Conventions for editing the source of the TypeScript agents in this repo (atlas-explorer, atlas-query-insights): agent.yaml, main.ts, config.ts, the packages/*-agent libraries, tool allowlists, approval middleware, vendored skills, and dev.yaml. Use when changing how an agent is built or what it is allowed to do. Not for running agentengine or Atlas commands, setting secrets, or deploying; use deploy-mongodb-agents.
- Reads credentials
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Shared behavior belongs in
packages/agent-engine-core: Don't copy middleware between the two agents. - Very specific: line 38
Never edit .agentengine/. The CLI generates it and can overwrite it.
- Very specific: line 43
Run agentengine from the agent directory, or from the repo root with --workspace <name>.
- Very specific: line 84
Outbound traffic is blocked by default: Every host the agent calls must be in network.egress: Atlas and MCP hosts, plus the model provider …
- Very specific: line 85
MONGODB_URIis injected: Don't declare it.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Working on the Atlas Agent Engine agents
Both agents in agents/ are TypeScript deep agents built on @mongodb-js/agent-engine-sdk-langgraph. Read the agent's own README.md first. This skill covers the repo conventions that aren't obvious from the code. For platform questions, use atlas-agent-engine-docs. For deploying, use deploy-mongodb-agents.
Layout
agent.yaml # root manifest: registers each workspace under agents/
project-config.yaml # project-level settings (memory), shared by all agents
agents/<name>/
├── agent.yaml # this agent's manifest: secrets, egress, MCP, features
├── dev.yaml # local-only service ports for `agentengine dev up`
├── src/agent_<name>/
│ ├── main.ts # App entrypoint: builds the agent
│ └── config.ts # non-secret settings: LLM provider/model, prompt persona
└── skills/ # vendored MongoDB Agent Skills, loaded at runtime
apps/
└── atlas-explorer-slack-bot/ # Atlas Explorer Slack app wrapping @repo/agent-engine-chat
packages/
├── agent-engine-core/ # shared: LLM builder, tool policy, middleware, test client
├── <name>-agent/ # this agent's prompt, tool allowlist, middleware
└── agent-engine-chat/ # reusable Chat SDK library for any Agent Engine workspace- Behavior belongs in
packages/<name>-agent: system prompt, tool allowlists, approval and error middleware.main.tsshould only assemble them. - Shared behavior belongs in
packages/agent-engine-core. Don't copy middleware between the two agents. - Chat integration belongs in
packages/agent-engine-chat. It connects any agent inagents/to Slack or other Chat SDK platforms;apps/atlas-explorer-slack-botis the Atlas Explorer Slack wrapper around it. pnpm buildbundles the library intodist/agent_<name>/main.jswith esbuild, so the platform runs one file plus npm dependencies. It also copies that bundle tosrc/agent_<name>/main.bundle.js, which is git-ignored for the dev container. Don't edit either file.- Apps import each library's compiled
dist. Scripts at the repo root and in each agent build the libraries first. If you runvitestortscdirectly, build them yourself.
Rules
- Never edit
.agentengine/. The CLI generates it and can overwrite it. - Secrets go in
.envlocally (git-ignored) and inagentengine secret setfor deployed agents.agent.yamllists secret names only, never values. - Agent Engine injects only secret env vars. Provider, model and persona are not secrets, so they live in
config.ts, notagent.yamlor.env. dev.yamlholds local-only settings (ports, local vs remote MongoDB). The build and deploy never read it.- Apache headers are added to staged
.ts,.jsand.shfiles by the pre-commit hook (addlicense). Install it perCONTRIBUTING.mdor the commit fails. - Run
agentenginefrom the agent directory, or from the repo root with--workspace <name>.
agent.yaml
The fields these agents use. Check each against an existing agents/*/agent.yaml before adding a new one.
name: atlas-explorer
entrypoint: agent_atlas_explorer.main:app # compiled output: dist/agent_atlas_explorer/main.js
framework: langgraph
language: typescript
features:
memory: false
deep_agent: true
required_secrets:
aer: # secrets the agent runtime reads
- ATLAS_MCP_CLIENT_ID
tools: # secrets each tool sandbox reads
invoke_llm: # reserved name: model calls run in the tool sandbox
- OPENAI_API_KEY
"mongodb__*": # MCP tools are prefixed `mongodb__`
- ATLAS_MCP_CLIENT_ID
network:
egress:
- fqdn: api.openai.com
ports: [443]
component: tool # values used here: tool, all
mcp:
servers:
mongodb:
transport: streamable_http
url: https://mcp.mongodb.com
auth:
type: client_credentials
token_url: https://cloud.mongodb.com/api/oauth/token
client_id_env: ATLAS_MCP_CLIENT_ID
client_secret_env: ATLAS_MCP_CLIENT_SECRETentrypointis<module>:<export>for theAppthatmain.tsexports. It names the compiled module, notsrc/.- A secret must be declared where it is read. The model key is needed under both
required_secrets.aerandrequired_secrets.tools.invoke_llm. The Atlas credentials are needed underaerandtools."mongodb__*". A secret set on the platform but not declared isn't available. - Outbound traffic is blocked by default. Every host the agent calls must be in
network.egress: Atlas and MCP hosts, plus the model provider withcomponent: tool. MONGODB_URIis injected. Don't declare it.- Memory is off (
features.memory: false). The long-term memory settings inproject-config.yamldon't apply to these agents. - Changing the model provider means changing
config.ts, the key underrequired_secrets, and the host undernetwork.egresstogether. - Validate with
agentengine agent validatefrom the agent directory. It checks the manifest only.
main.ts
Both agents follow the same shape:
export const app = new App({ appName }), thenapp.prepareAgentInput(...).export const buildAgent = app.entrypoint(() => { ... })builds the agent. Inside it:app.getTools()returns the tools discovered from the MCP server inagent.yaml. Pass them through the agent's tool-selection function so only allowed tools are exposed.app.checkpointer()may returnnull; the existing agents handle that. Wrap it withwithRequesterMetadataand pass it as the agent's checkpointer.app.deepAgent(llm, { tools, systemPrompt, skills: ["skills"], backend, checkpointer, middleware })builds the agent.backendiswithoutShellExecution(new AgentEngineToolSandboxBackend()), so the agent has no shell.
app.run()starts it.
buildLLM({ provider, model }) is built in agent-engine-core and imported through each agent's package, with the values from config.ts. Keep the middleware order of the existing agents, and run the package tests if you change it.
Tools and write policy
- MCP tools aren't declared in code. They come from
agent.yaml'smcpblock and are discovered at startup. - Each agent has an allowlist of tool names in its package:
READ_ONLY_MCP_TOOLSinpackages/atlas-explorer-agent/src/agentPolicy.tsandATLAS_QUERY_INSIGHTS_MCP_TOOLSinpackages/atlas-query-insights-agent/src/toolPolicy.ts. A new MCP tool is not exposed until it's added to the right allowlist, so adding a tool is a security-relevant change. - Atlas Query Insights is read-only. It rejects aggregation pipelines that write (
rejectAggregateWritesMiddleware). Don't add write tools to it. - Atlas Explorer is read-only unless
ALLOW_WRITE_OPERATIONSis set, and the MCP credential has a write role. When writes are on, every tool not on the read allowlist pauses for human approval (humanInTheLoopMiddlewarewithmutativeInterruptOn). Aggregations containing$outor$mergealso need approval (approveAggregateWritesMiddleware).atlas_create_db_userandatlas_create_access_listare never exposed. - A read-only MCP credential is the hard limit. The allowlist and approvals reduce risk, but Atlas enforcement is what actually stops a write.
Human approval
Approval pauses the session at a checkpoint and resumes it after a decision. The decisions are approve, edit and reject (packages/agent-engine-core/src/aggregateWriteApproval.ts). stampResumeClientUserMiddleware carries the client user onto the resumed run. The Slack bot (apps/atlas-explorer-slack-bot) offers Approve and Reject only.
Skills
skills/ holds vendored MongoDB Agent Skills, and skills: ["skills"] points the agent at that directory. The runtime discovers only immediate child folders that contain a SKILL.md, and skips any with a missing or unparsable name or description.
These are Atlas Explorer-specific forks of mongodb/agent-skills (they use the mongodb__ tool prefix). Pulling upstream drops those adaptations. These are the agent's runtime skills, not the development skills in .agents/skills/.
Local development and tests
pnpm build # from the agent dir; required after source changes
agentengine dev up # Playground on http://localhost:3000
agentengine dev restart # after a rebuild; the dev container runs the bundle
agentengine dev stopBoth agents use port 3000 (Playground) and 8000 (Orchestration Engine), so run one at a time.
pnpm test:atlas-explorer # from the repo root; also test:atlas-query-insights
pnpm --filter <package> typecheckUnit tests mock the LLM and MCP. Prefer them over real model calls. pnpm test:integration (from the agent directory) needs agentengine dev up --headless and real Atlas MCP and model credentials. See CONTRIBUTING.md for the two-phase Explorer write test.
Before opening a PR
pnpm test:<agent>
pnpm build:<agent>
agentengine agent validate # from the agent directoryShow any agent.yaml change in the PR description, because it changes what the agent can read, reach or write.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- mongodb/agent-engine-examples★ 6same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- mongodb-atlas-stream-processingSkill
- mongodb-connectionSkill
- mongodb-mcp-setupSkill
- mongodb-natural-language-queryingSkill
- mongodb-qe-size-estimationSkill
- mongodb-query-optimizerSkill
- mongodb-schema-designSkill
- mongodb-search-and-aiSkill
- mongodb-connectionSkill
- mongodb-natural-language-queryingSkill
- mongodb-query-optimizerSkill
- mongodb-schema-designSkill
- mongodb-search-and-aiSkill
- agent-engine-feature-validationsSkill
- agent-engine-troubleshoot-deploySkill
- atlas-agent-engine-docsSkill
- chat-sdk-add-adapterSkill
- chat-sdkSkill
- deploy-mongodb-agentsSkill
- gh-stackSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

