create-atomic-context-provider
यह क्या करती है
यह बताती है कि context provider कैसे लिखें जो हर रन पर एजेंट के सिस्टम प्रॉम्प्ट में शीर्षक वाला ब्लॉक जोड़े। यह उन डेवलपर्स के लिए है जो चाहते हैं कि उनका एजेंट मौजूदा या मिली हुई जानकारी जाने।
कब इस्तेमाल करें
- ✓जब डेवलपर चाहे कि एजेंट हर कॉल पर मौजूदा समय या उपयोगकर्ता पहचान जाने।
- ✓जब डेवलपर चाहे कि मिले हुए दस्तावेज़ एजेंट के प्रॉम्प्ट में डाले जाएँ।
- ✓जब दो एजेंट को एक ही सेशन की जानकारी साझा करनी हो।
Skill का लिंक
https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-context-provider/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक context provider जोड़िए जो मेरे एजेंट को मौजूदा उपयोगकर्ता का नाम और उनकी सहेजी पसंदें दे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल पूछती है कि डेटा कहाँ से आता है और कितना ताज़ा होना चाहिए, फिर एक provider क्लास लिखती है जो शीर्षक वाला ब्लॉक लौटाती है और उसे एजेंट के साथ रजिस्टर करती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Create an Atomic Agents Context Provider
A context provider injects a named, titled block into the agent's system prompt at every run(). The base prompt stays static; the context is what changes between calls.
For deep material (caching strategies, async data sources, multi-agent sharing patterns), the authority is ../framework/references/context-providers.md. This skill is the action-oriented path: clarify → write → register.
When this fires vs the umbrella framework skill
- This skill: the user wants to add a provider — "inject the user's name", "make the agent see the current time", "feed retrieved docs into the prompt", "share session state across two agents".
frameworkskill: questions about Atomic Agents in general, or about something other than authoring a provider.
Phase 1 — Clarify
Bundle into one message:
- What goes into the prompt? One sentence. Defines the provider's job.
- Where does the data come from? In-memory state mutated by your code? A vector DB lookup? A REST call? A clock?
- How fresh must it be? Per-
run()(default), every N seconds (cache), or refreshed externally before each call (async data). - Which agent(s)? One agent, or shared across multiple agents?
Skip what's already obvious from context.
Phase 2 — Plan
Confirm in one short block:
- File:
<project>/context_providers.py(or alongside the agent that owns it). - Class:
<Topic>Ctx(BaseDynamicContextProvider). - Title (rendered as the section header in the prompt) — must be unique across providers on the same agent.
- Update mechanism: mutate fields between
run()calls (most common), set via a method, orawait refresh()for async sources.
Phase 3 — Implement
Skeleton
from atomic_agents.context import BaseDynamicContextProvider
class UserCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="User Context")
self.name: str = ""
self.role: str = ""
def get_info(self) -> str:
if not self.name:
return "No user is logged in."
return f"User: {self.name} (role: {self.role})"
get_info() is synchronous and runs on every agent.run() — keep it cheap. No HTTP, no DB queries, no file I/O. Cache slow sources (see "Cached" pattern below). For async data sources, await provider.refresh() from your loop before calling the agent.
Common patterns
Time — read-only, no state mutation needed:
from datetime import datetime, timezone
class TimeCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="Current Time")
def get_info(self) -> str:
return datetime.now(timezone.utc).isoformat()
RAG / retrieved docs — set externally, read inside get_info():
class RAGCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="Retrieved Documents")
self.docs: list[dict] = []
def set(self, docs: list[dict]) -> None:
self.docs = docs
def get_info(self) -> str:
if not self.docs:
return "No relevant documents retrieved."
return "\n\n".join(f"[{d['source']}] {d['content']}" for d in self.docs)
# In the calling code, just before agent.run():
rag.set(vector_db.search(query, k=4))
agent.run(query_input)
Session — mutable key/value state shared across agents:
class SessionCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="Session")
self._data: dict[str, str] = {}
def set(self, key: str, value: str) -> None:
self._data[key] = value
def get_info(self) -> str:
if not self._data:
return "No session state."
return "\n".join(f"- {k}: {v}" for k, v in self._data.items())
Cached — for slow sources (DB schema, expensive computation):
import time
class DBSchemaCtx(BaseDynamicContextProvider):
def __init__(self, conn, ttl_seconds: int = 300):
super().__init__(title="Database Schema")
self._conn = conn
self._ttl = ttl_seconds
self._cached: str = ""
self._at: float = 0.0
def get_info(self) -> str:
now = time.time()
if not self._cached or now - self._at > self._ttl:
self._cached = render_schema(self._conn)
self._at = now
return self._cached
Async source — refresh outside, read sync inside:
clas
अक्सर पूछे जाने वाले सवाल
context provider क्या है?
यह एक कोड का टुकड़ा है जो एजेंट के चलने पर सिस्टम प्रॉम्प्ट में एक नाम वाला खंड जोड़ता है।
क्या यह मूल प्रॉम्प्ट बदलता है?
नहीं। मूल प्रॉम्प्ट वही रहता है, और कॉल के बीच केवल जोड़ा गया संदर्भ बदलता है।
क्या एक provider कई एजेंट को सेवा दे सकता है?
हाँ। स्किल एजेंटों के बीच provider साझा करने को कवर करती है।
जानकारी
लेखक का मूल विवरण
Build a `BaseDynamicContextProvider` that injects a named, titled block into an agent's system prompt at every `run()` — current time, user identity, retrieved RAG docs, session state, cached DB schema. Use when the user asks to "add a context provider", "inject X into the prompt", "give the agent dynamic context", "wire up RAG", "make a `BaseDynamicContextProvider`", or runs `/atomic-agents:create-atomic-context-provider`.
repo: Eigenwise/atomic-agents
लोकप्रियता
- GitHub स्टार
- 6.3k
- रैंकिंग में स्थान
- #14238
- लाइसेंस
- MIT
- अपडेट की गई
- 29/10/2026
कमेंट
- …
इस repository की और skills
create-atomic-agent
6.3kआपके एजेंट को टाइप्ड इनपुट और आउटपुट, सिस्टम प्रॉम्प्ट और चुने गए AI प्रदाता के साथ नया Atomic Agents एजेंट बनाने में मदद करती है।
create-atomic-schema
6.3kआपके एजेंट को Atomic Agents एजेंट और टूल के लिए साफ़ फ़ील्ड विवरण वाले टाइप्ड इनपुट और आउटपुट schemas डिज़ाइन करने में मदद करती है।
create-atomic-tool
6.3kआपके एजेंट को Atomic Agents ऐप के लिए टाइप्ड टूल बनाने में मदद करती है, जैसे API रैपर या कैलकुलेटर जिसे एजेंट बुला सके।
framework
6.3kआपके एजेंट को Atomic Agents Python फ़्रेमवर्क के साथ सही तरीके से काम करने में मदद करती है, जिसमें schemas, एजेंट, टूल, प्रॉम्प्ट और प्रदाता सेटअप शामिल हैं।
मिलती-जुलती skills
add-model-provider
394kयह आपके एजेंट को सुरक्षित कमांड से OpenClaw में नया AI मॉडल प्रोवाइडर जोड़ने, API कीज़ को सादे टेक्स्ट से बचाने और लाइव टेस्ट चलाने देती है।
acp-router
394kयह आपके एजेंट को OpenClaw के ज़रिए Claude Code या Cursor जैसे कोडिंग असिस्टेंट को काम भेजने देती है, ताकि काम उसी टूल में चले।
browser-automation
394kयह आपके एजेंट को लॉगिन, टैब और अटकी वेब पेज से उबरने समेत, वेबसाइट पर चरण-दर-चरण काम करना सिखाती है।