How should enterprise AI agents cache, refresh, and select skills in runtime?

Hi there,

I’m are building an AI Agent that uses skill.md files.

Each skill.md contains:

  • Skill metadata
    • skill_name
    • description
    • examples
    • business domain
    • tags
  • Execution instructions
  • SQL query itself
  • Snowflake execution details

Workflow:

  1. User asks a question.
  2. LLM reviews available skill metadata.
  3. LLM selects the most relevant skill.
  4. Full skill.md is loaded.
  5. SQL executes on Snowflake.
  6. Results are returned to UI.

Requirements:

  • New skills must be dynamically discoverable at runtime.
  • No application redeployment when adding new skills.
  • Minimize latency.
  • Avoid fetching all skill files for every user request.
  • Enterprise-grade architecture.
  • Skills may be updated at any time.
  • Skill selection must scale to hundreds or thousands of skills.(if needed)
  • Agent runs in Kubernetes.
  • Snowflake is the data source, skill.md files loookup is in oracle database
  • MCP can be used if necessary but should not become a bottleneck.

Current Ideas:

Approach A:

  • Store skills in a Git repository.
  • Use MCP to fetch skills.
  • Rejected due to dependency on external Git-based workflow.

Approach B:

  • Store skills in oracle DB lookup tables.
  • using MCP Call to Load all skills into memory during pod startup.
  • LLM uses metadata to select skill.
  • Full skill loaded from memory when selected.
  • Problem: Pod restart required when new skills are added.

Approach C:

  • Invoke MCP and fetch skills on every user request.
  • Rejected due to performance and latency concerns.

Tasks:

  1. Design an enterprise-grade architecture for dynamic skill management.
  2. Explain how large-scale AI agents typically manage dynamic skills.
  3. Recommend:
    • Skill registry design
    • Metadata catalog design
    • Cache strategy
    • Refresh strategy
    • Versioning strategy
    • Skill discovery architecture
    • Skill selection architecture
    • MCP usage strategy
    • Kubernetes deployment pattern
  4. Explain whether polling, event-driven refresh, or cache invalidation is best.
  5. Explain how new skills can become available immediately without pod restarts.
  6. Provide reference architecture diagrams using Mermaid.
  7. Provide scalability considerations for:
    • 100 skills
  8. Describe best practices used by enterprise AI platforms.
  9. Provide a final recommended architecture with pros, cons, implementation steps, and operational considerations.

Tech Stack :
Python 3.13, Langchain, LangGraph, FastAPI, Pydantic V2, Angular frontend, LLM - Azure OpenAI models - Gpt - 5 - Mini

Hi Sandeep,

Deep Agents has this built in, so I’d start there. The skills docs cover the setup.

Skills are read through a backend, and you can write your own. For your setup I’d write a small backend that reads skills from your Oracle table, then use CompositeBackend to send /skills/ to it. That keeps Oracle as the source of truth, and you don’t need Git per request.

Skills are loaded on a thread’s first run, not when the pod starts, so a new skill is picked up by the next new thread without a redeploy. Existing threads keep the skills list from their first run. To refresh it, set skills_metadata to None in that thread’s state, and the next run reloads it.

One thing worth knowing is that each new thread reads every SKILL.md to build the metadata list. If you start a thread per question, that would mean reading every skill on every request. You might want your backend to serve skills from an in-memory cache, refreshed on a TTL or when a version column in Oracle changes. That way a new thread only costs a cheap check.

If you have more than a few hundred skills, the metadata list alone will take up a lot of the prompt, so you may want to filter it based on the user before the model sees it.

One small version note for anyone trying the refresh step: the skills docs say it requires deepagents >= 0.7.16. They also distinguish runs with a checkpointer from those without one: without a checkpointer, the skills state doesn’t survive between runs, so each run loads it again. That’s worth checking if local behavior differs from the deployed agent.