TradingAgents API configuration

Updated 2026-09-06

Documented model client connect کریں، پھر research graph الگ validate کریں۔ یہ source-reviewed guide provider configuration، financial data dependencies اور bounded first experiment cover کرتی ہے۔

Versioned research question سے شروع کریں

Compatible provider، custom backend URL اور دو model roles set کریں، پھر defined research date پر ایک company test کریں۔ TradingAgents analysts، opposing research arguments اور risk review organize کرتا ہے، اس لیے پہلا useful task یہ ہے کہ وہی source packet roles کیسے explain کرتی ہیں۔ Model بدلنے سے پہلے company اور information cutoff چنیں۔ First run کے underlying facts اور unresolved items محفوظ کریں تاکہ later comparison same question استعمال کرے۔ نیچے کے fields service revision 9dee508c follow کرتے ہیں۔

Compatible provider اور دونوں model roles configure کریں

Reviewed default_config.py میں llm_provider، backend_url، deep_think_llm اور quick_think_llm ہیں۔ Compatible client supplied endpoint استعمال کرتا ہے؛ authentication الگ environment setting ہے۔ دونوں role slots کو chosen endpoint اور project client سے accepted exact model identifier چاہیے۔ یہ example source fields کو adapt کر کے صرف configuration بناتی ہے۔ Required capabilities چیک کرنے کے بعد RESEARCH_MODEL_ID اور SUMMARY_MODEL_ID current catalog سے set کریں۔ یہ 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 سے independently 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 کا connection دکھاتا ہے؛ financial-data tools اپنی credentials، coverage اور source timestamps رکھتی ہیں۔ Missing research input کو LLM failure کہنے سے پہلے ان tools کو check کریں۔

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 کی actual capabilities test کریں۔ Text reply tool-call parsing، long-context handling یا structured-output behavior ثابت نہیں کرتی۔ Model family بدلنے سے provider adapter behavior بھی بدل سکتا ہے، چاہے endpoint identifier قبول کرے۔ Smallest useful roles سے شروع کریں؛ debate تب add کریں جب unsupported claims یا useful counterevidence identify ہو۔ Final artifact کو same source packet سے evaluate کریں، longer report کو automatically better research نہ سمجھیں۔

RoleRequired evidenceFailure to inspect
AnalystTool result اور source locatorData error کے بعد invented facts
Research debateArguments analyst evidence سے linkedRepeated 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 exercise کریں اور redacted request record رکھیں۔ Required tool interaction اور اس کا error path test کریں۔ آخر میں bounded source set کے ساتھ TradingAgentsGraph چلائیں اور resulting state، cited facts اور final research output inspect کریں۔ Repository revision، dependency versions، input hashes اور role settings save کریں۔ Factory response صرف client stage pass کرتی ہے؛ complete report کو usable research artifact ماننے سے پہلے 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 ہونے کا proof نہیں۔ Cutoff تک fundamentals available تھیں یا نہیں، articles بعد میں correct ہوئیں یا نہیں اور cached data دوسرے experiment سے آئی یا نہیں، check کریں۔ Original publication time اور ingestion time الگ محفوظ کریں۔ Training یا reflection feedback held-out evaluation period سے باہر رکھیں۔ Historical ticker lists میں delistings اور symbol changes شامل کریں۔ Corporate-action handling اور comparison benchmark ہر experiment کے ساتھ record کریں تاکہ model change data change نہ بن جائے۔

Debate، retries اور repeated context کا budget بنائیں

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 limit کریں۔ Document versions سے source extraction cache کریں اور application reuse کو provider billing discount سے الگ سمجھیں۔ Data subscriptions اور local compute کو LLM charges سے الگ track کریں۔ Ticker اور date universe بڑھانے سے پہلے bounded run مکمل کریں۔

جو stage fail ہوئی اسے diagnose کریں

Authentication failure میں verify کریں compatible-provider key اسی process تک پہنچتی ہے جو client بناتا ہے۔ Missing model میں exact identifier اور account access کو current catalog سے compare کریں۔ 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 کرنے سے original failure چھپ سکتی ہے اور پورا research budget ختم ہو سکتا ہے۔

Evidence اور limitations

Configuration 5 ستمبر 2026 کو revision 9dee508c پر source-reviewed تھی۔ 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 اور required capabilities validate کریں؛ shared endpoint compatibility ثابت نہیں کرتی۔

کیا endpoint stock prices فراہم کرتی ہے؟

نہیں۔ Market data الگ configured vendor tools سے آتی ہے، اپنی coverage، credentials، licensing اور availability کے ساتھ۔

Propagation کے لیے کون سی date دوں؟

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 کریں، پھر same source packet کی accepted reports compare کریں۔

کیا successful graph trading strategy ثابت کرتی ہے؟

نہیں۔ یہ tested inputs کے تحت workflow result ثابت کرتی ہے۔ Strategy evaluation کو point-in-time data، independent evaluation اور realistic execution assumptions درکار ہیں۔