Agently क्या है?
Agently आउटपुट कॉन्ट्रैक्ट, ऑब्ज़र्वेबल Actions और इवेंट-ड्रिवन वर्कफ़्लो के साथ AI सर्विस बैकएंड बनाने वाला Python framework. यह App Orchestration टूल्स की App Frameworks श्रेणी में आता है; ओपन सोर्स है, Python में लिखा गया है और Apache-2.0 लाइसेंस के तहत है। शुरू करने के लिए: इंस्टॉल करें.
सारांश
Agently एक ओपन सोर्स Python framework है, जिसे AgentEra मेंटेन करता है। इसका उपयोग AI ऐप्लिकेशन का बैकएंड बनाने के लिए होता है। इसका फ़ोकस मॉडल कॉल के आसपास की engineering layer पर है: एक रिक्वेस्ट नामित prompt स्लॉट (role, info, instruct, input, output) से बनती है, अपेक्षित नतीजे का आकार `.output(...)` से घोषित किया जाता है, और provider के native JSON mode पर अकेले निर्भर रहने के बजाय parsing, required-key checks, retries और validation handlers की ज़िम्मेदारी फ्रेमवर्क खुद उठाता है। हर model provider के सामने एक ही request contract रहता है, इसलिए प्रोजेक्ट का घोषित लक्ष्य है कि DeepSeek को लोकल Ollama model या Claude से बदलने पर downstream business code को जो मिलता है, वह नहीं बदलता।
इसके ऊपर कई opt-in हिस्से हैं। Actions वे capabilities हैं जिन्हें model call कर सकता है: decorated local functions, MCP servers, built-in Search और Browse packages, और managed Python, shell, Node.js और SQLite runtimes; और हर call एक structured action log छोड़ता है। TriggerFlow वर्कफ़्लो लेयर है: एक event- और signal-driven engine, जिसमें branching, `for_each` fan-out, pause/resume, human-in-the-loop events, save/load और close snapshots शामिल हैं। Dynamic Task model या ऐप द्वारा बनाए गए DAG को एक validated task graph में बदलता है, जो TriggerFlow पर चलता है, और Session bounded multi-turn memory रखता है।

Agently model के stream होते समय भी structure दिखाता है: इसका `instant` mode हर output field के लिए events emit करता है, ताकि UI या SSE route आखिरी token से पहले ही आंशिक structured जवाब दिखा सके। `FastAPIHelper` agents, requests और TriggerFlow executions को POST, SSE या WebSocket पर publish करता है, और वैकल्पिक `agently-devtools` package runtime observation, evaluations और playground के लिए एक लोकल console जोड़ता है। Core, Apache-2.0 लाइसेंस वाला है और open-core model पर आधारित है, Python 3.10 या उससे नए version की ज़रूरत है, और PyPI पर `agently` नाम से प्रकाशित है।
यह क्या करता है
- Contract-first structured output — required fields वाले `.output(...)` schemas, `ensure_keys`, parser feedback, retries और validation handlers; ये YAML या JSON prompt files में भी लिखे जा सकते हैं
- सभी providers के लिए एक request contract — OpenAI-compatible requester (OpenAI, DeepSeek, Qwen, Ollama, Kimi, GLM और अन्य) के साथ Anthropic-compatible requester, और failover के लिए model pools तथा API-key pools
- `instant` structured streaming, जो model generate करते समय हर field path के लिए एक event emit करता है, लाइव UIs और SSE routes के लिए
- Actions runtime जो decorated Python functions, MCP servers, built-in Search/Browse और managed Python, shell, Node.js तथा SQLite resources को सपोर्ट करता है, structured action logs के साथ
- TriggerFlow event-driven workflows — branching, fan-out, external events, pause/resume, persistence और close snapshots के साथ, साथ ही validated DAG plans के लिए Dynamic Task
- Service और tooling surfaces: POST/SSE/WebSocket exposure के लिए FastAPIHelper, और observation तथा evaluation के लिए वैकल्पिक agently-devtools console
शुरू करें
Agently एक Python package है (Python 3.10+)। model के रूप में कोई भी OpenAI-compatible endpoint काम करता है; README के quickstart में DeepSeek की hosted API या एक लोकल Ollama model इस्तेमाल होता है।
इंस्टॉल करें
PyPI से package इंस्टॉल या अपग्रेड करें।
pip install -U agentlyModel कॉन्फ़िगर करें और structured output माँगें
Agently को किसी OpenAI-compatible endpoint की ओर इंगित करें, एक agent बनाएँ, और .output() से result का आकार घोषित करें। tuple का तीसरा item किसी field को required चिह्नित करता है।
from agently import Agently
Agently.set_settings(
"OpenAICompatible",
{
"base_url": "https://api.deepseek.com/v1",
"model": "deepseek-v4-flash",
"api_key": "${ENV.DEEPSEEK_API_KEY}",
"model_type": "chat",
},
)
agent = Agently.create_agent()
result = (
agent
.input("Introduce Python in one sentence and state three distinct strengths.")
.output({
"intro": (str, "one sentence", True),
"strengths": {
"first": (str, "first strength", True),
"second": (str, "second strength", True),
"third": (str, "third strength", True),
},
})
.get_result()
)
print(result.get_data())या लोकल model पर चलाएँ
सिर्फ़ provider settings बदलकर Ollama इस्तेमाल करें; request का कोड वही रहता है।
# ollama pull qwen2.5:7b
Agently.set_settings(
"OpenAICompatible",
{
"base_url": "http://127.0.0.1:11434/v1",
"model": "qwen2.5:7b",
"api_key": "ollama",
"model_type": "chat",
},
)Agent को एक action दें
किसी function को @agent.action_func से decorate करें और register करें; model उसे call कर सकता है, और calls का रिकॉर्ड result के action logs में दर्ज होता है।
@agent.action_func
def calculate_total(price: float, quantity: int) -> float:
"""Calculate an order total."""
return price * quantity
agent.use_actions(calculate_total)
result = agent.input("Use the available action to calculate 19.5 * 4, then explain the result.").get_result()
print(result.get_text())DevTools से runs की निगरानी करें (वैकल्पिक)
companion devtools package इंस्टॉल करें, उसका लोकल console शुरू करें, और हर run देखने के लिए अपने ऐप में ObservationBridge attach करें।
pip install -U agently agently-devtools
agently-devtools start
कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।
कब इस्तेमाल करें
- जब AI-backed API को hosted और local models के बीच स्विच करते हुए भी स्थिर JSON शेप लौटाना हो, तब इसका इस्तेमाल करें
- जब model के पूरा होने से पहले ही आंशिक रूप से भरे structured जवाब chat UI या SSE endpoint पर स्ट्रीम करने हों, तब इसे चुनें
- जब कई चरणों वाली AI प्रक्रिया में branching, fan-out, human approval pauses और restart-safe state चाहिए, वह भी सादे Python में, तब इसका इस्तेमाल करें

- जब model को free-form tool calls के बजाय सीमित और logged actions के ज़रिए business objects पर काम करने देना हो, तब इसे इस्तेमाल करें
How Agently compares
Agently alongside other open-source app frameworks tools AI/TLDR tracks, ranked by GitHub stars.
| टूल | स्टार | यह क्या करता है |
|---|---|---|
| LangChain | ★ 150k | आपस में जुड़ने वाले और बदले जा सकने वाले components से agents और LLM ऐप बनाएं |
| LlamaIndex | ★ 53.1k | रिट्रीवल और एजेंट्स के ज़रिए भाषा मॉडल को अपने डेटा से जोड़ें |
| Haystack | ★ 27.2k | प्रोडक्शन RAG पाइपलाइन और LLM एजेंट बनाने के लिए ओपन सोर्स Python फ़्रेमवर्क |
| Jina | ★ 21.9k | gRPC, HTTP और WebSockets पर संवाद करने वाली AI सर्विस बनाएं और चलाएं |
| RocketRide | ★ 19.9k | एक ओपन सोर्स, MIT लाइसेंस वाला AI मेटा-हार्नेस, जो C++ रनटाइम पर चलता है: VS Code, CLI, Python और TypeScript SDK, या इसके बिल्ट-इन MCP सर्वर से AI एजेंट और RAG पाइपलाइन बनाएं, टेस्ट करें और चलाएं |
| LLM | ★ 12.9k | कमांड लाइन से दर्जनों लैंग्वेज मॉडल इस्तेमाल करें, और हर एक को SQLite में लॉग करें |
| Prompt Flow | ★ 11.3k | लिंक्ड flows के साथ production-quality LLM ऐप्स बनाएँ, टेस्ट करें और शिप करें |
| Agently | ★ 1.7k | आउटपुट कॉन्ट्रैक्ट, ऑब्ज़र्वेबल Actions और इवेंट-ड्रिवन वर्कफ़्लो के साथ AI सर्विस बैकएंड बनाने वाला Python framework |
