TradingAgents API कॉन्फ़िगरेशन

Updated 2026-09-06

Documented model client connect करें, फिर research graph को अलग से validate करें। यह source-reviewed guide provider configuration, financial data dependencies और पहले सीमित experiment को कवर करती है।

Versioned research question से शुरुआत करें

Compatible provider, custom backend URL और दो model roles तय करें, फिर निश्चित research date पर एक company test करें। TradingAgents analysts, opposing research arguments और risk review व्यवस्थित करता है, इसलिए पहला उपयोगी task यह देखना है कि ये roles एक ही source packet को कैसे समझाते हैं। Model बदलने से पहले company और information cutoff चुनें। पहली run के underlying facts और unresolved items सुरक्षित रखें, ताकि बाद की model comparisons उसी question पर हों। नीचे के fields service revision 9dee508c का अनुसरण करते हैं।

Compatible provider और दोनों model roles configure करें

Reviewed default_config.py में llm_provider, backend_url, deep_think_llm और quick_think_llm exposed हैं। Compatible client दिया गया endpoint इस्तेमाल करता है; authentication अलग environment setting है। दोनों role slots में chosen endpoint और project client द्वारा स्वीकार किया गया exact model identifier चाहिए। उदाहरण इन source fields को adapt करता है और केवल configuration बनाता है। Required capabilities जांचने के बाद current catalog से RESEARCH_MODEL_ID और SUMMARY_MODEL_ID चुनें। ये local environment slots हैं, model IDs या TradingAgents defaults नहीं। Credential script में नहीं, process environment में रखें।

import os
from copy import deepcopy
from tradingagents.default_config import DEFAULT_CONFIG

config = deepcopy(DEFAULT_CONFIG)
config.update({
    "llm_provider": "openai_compatible",
    "backend_url": "https://api.apisrouter.com/v1",
    "deep_think_llm": os.environ["RESEARCH_MODEL_ID"],
    "quick_think_llm": os.environ["SUMMARY_MODEL_ID"],
    "max_debate_rounds": 1,
    "max_risk_discuss_rounds": 1,
})
assert os.environ["OPENAI_COMPATIBLE_API_KEY"]
# Configuration only. This does not start a research run.

Model route को financial data से अलग रखें

Financial-data vendors को model endpoint से स्वतंत्र रूप से configure करें। International equities के लिए collection से पहले issuer और exchange-specific symbol resolve करें। Trading currency, reporting currency, market timezone और benchmark choice सुरक्षित रखें। US-listed depositary receipt और underlying ordinary share की price series compare करने से पहले explicit conversion rule चाहिए। Diagram दिखाता है कि model settings कैसे जुड़ती हैं; financial-data tools अपने credentials, coverage और source timestamps बनाए रखते हैं। Missing research input को LLM failure मानने से पहले उन tools को जांचें।

TradingAgents model configuration route अपने compatible provider के जरिए research और summary model slots तक।TradingAgents routes through openai_compatible + backend_url to the APIsRouter gateway (api.apisrouter.com/v1), which fans out to: Research model slot, Summary model slot.TradingAgentsviaopenai_compatible +backend_urlAPIsRouterapi.apisrouter.com/v1Research model slotSummary model slot
Documented model-client route। Market-data configuration अलग रहती है।

Task contract के अनुसार roles चुनें

हर role द्वारा वास्तव में इस्तेमाल की जाने वाली capabilities test करें। Text reply tool-call parsing, long-context handling या structured-output behavior सिद्ध नहीं करता। Model family बदलने पर provider adapter behavior भी बदल सकता है, भले endpoint उसका identifier स्वीकार करे। सबसे छोटे उपयोगी roles से शुरू करें; debate तभी जोड़ें जब वह unsupported claims या उपयोगी counterevidence पहचाने। Final artifact का मूल्यांकन उसी source packet पर करें, longer report को अपने-आप बेहतर research न मानें।

भूमिकाआवश्यक प्रमाणजिस failure की जांच करनी है
विश्लेषकTool result और source locatorData error के बाद invented facts
Research debateAnalyst evidence से जुड़े argumentsRepeated claims को corroboration बताना
Risk reviewExplicit assumptions और unresolved itemsVerified inputs के बिना confident position

Staged first-run acceptance test इस्तेमाल करें

पहले keys print किए बिना resolved configuration inspect करें। फिर authorized execution environment में selected model के साथ project client चलाएं और redacted request record रखें। उसके बाद required tool interaction और उसका error path test करें। अंत में सीमित source set के साथ TradingAgentsGraph चलाएं और resulting state, cited facts तथा final research output inspect करें। Repository revision, dependency versions, input hashes और role settings सुरक्षित रखें। Factory response केवल client stage पास करता है; usable research artifact माने जाने से पहले complete report को source और numerical review चाहिए।

import os
from research_config import config
from tradingagents.graph.trading_graph import TradingAgentsGraph

graph = TradingAgentsGraph(debug=False, config=config)
state, decision = graph.propagate(
    os.environ["RESEARCH_TICKER"],
    os.environ["RESEARCH_DATE"],
)
# Inspect state and decision against the source packet.
# Running this template makes model and data requests.

Historical research को बाद की information से बचाएं

Requested analysis date इस बात का प्रमाण नहीं है कि हर vendor response point-in-time था। जांचें कि fundamentals cutoff तक वास्तव में उपलब्ध थे या नहीं, articles बाद में सुधारे गए थे या नहीं और cached data किसी दूसरे experiment से आया था या नहीं। Original publication time और ingestion time अलग-अलग रखें। Training या reflection feedback को held-out evaluation period से बाहर रखें। Historical ticker lists में relevant delistings और symbol changes शामिल हों। हर experiment के साथ corporate-action handling और comparison benchmark दर्ज करें, ताकि model change को data change न समझा जाए।

Debate, retries और repeated context का बजट बनाएं

Financial-agent spend graph की हर request से आता है, summaries, repeated context और billable retries सहित। Planning में current pricing contract इस्तेमाल करें और बाद में actual request usage reconcile करें। Sweep से पहले debate rounds, source volume, parallel jobs और automatic retries सीमित करें। Document versions के आधार पर source extraction cache करें; application reuse को provider billing discount से अलग पहचानें। Data subscriptions और local compute को LLM charges से अलग track करें और cost per accepted research artifact की तुलना करें। Ticker और date universe बढ़ाने से पहले ऊपर दी bounded run से शुरुआत करें।

उस stage का निदान करें जो fail हुई

Authentication failures में जांचें कि compatible-provider key उसी process तक पहुंची है जो client बनाता है। Missing models में exact identifier और account access को current catalog से मिलाएं। Malformed tool output में केवल final exception नहीं, tool schema और sanitized response भी रखें। Stall data-vendor request, repeated tool loop या model timeout हो सकता है; limits बढ़ाने से पहले stage timestamps देखें। Mandatory data missing हो तो रुकें। Prose आने तक retry करना मूल failure छिपा सकता है और पूरा research budget खर्च कर सकता है।

प्रमाण और सीमाएं

Configuration को September 5, 2026 को revision 9dee508c पर source-review किया गया। Examples walkthrough templates हैं; इस guide के लिए कोई APIsRouter client request, complete graph या measured task-cost case execute नहीं किया गया। Workflow बढ़ाने से पहले अपने bounded run में selected models और data tools validate करें।

अक्सर पूछे जाने वाले प्रश्न

openai_compatible कौन-सी key पढ़ता है?

Reviewed provider OPENAI_COMPATIBLE_API_KEY से map होता है। इसे execution environment में set करें और secret print किए बिना resolved provider verify करें।

क्या दोनों roles अलग models इस्तेमाल कर सकते हैं?

Configuration में deep_think_llm और quick_think_llm अलग fields हैं। दोनों exact IDs और जरूरी capabilities validate करें; केवल shared endpoint compatibility सिद्ध नहीं करता।

क्या endpoint stock prices देता है?

नहीं। Market data अलग से configured vendor tools से आता है, जिनकी अपनी coverage, credentials, licensing और availability होती है।

Propagate करने के लिए कौन-सी date pass करूं?

Intended research date इस्तेमाल करें और अलग से verify करें कि हर data tool आपका information cutoff मानता है। केवल date argument current data को point-in-time नहीं बनाता।

दो model roles कैसे चुनूं?

Current catalog IDs इस्तेमाल करें, required tools और output formats test करें, फिर role बदलने से पहले उसी source packet से बने accepted reports की तुलना करें।

क्या successful graph trading strategy सिद्ध करता है?

नहीं। यह tested inputs के तहत workflow result स्थापित करता है। Strategy evaluation के लिए point-in-time data, independent evaluation और realistic execution assumptions चाहिए।