तुमने Python की पचास लाइनें लिखीं। एक system prompt, एक tool list, एक model call। तुम्हारा agent meetings बुक करता है, databases query करता है, emails भेजता है। Terminal में चकाचक चल रहा है। Ship कर दें?

पहले अपनी test file खोलो। हिम्मत है तो लिखो एक test — उस चीज़ के लिए जो हर बार पूछने पर अलग जवाब देती है।

Non-determinism की वो समस्या जिसके बारे में कोई बात नहीं करना चाहता

एक normal Python test ऐसा दिखता है:

def test_add():
    assert add(2, 2) == 4  # deterministic. हमेशा 4.

एक agent test ऐसा दिखता है:

def test_booking_agent():
    result = agent.run("Book a room for tomorrow 2pm")
    assert result == ???  # यहाँ क्या लिखोगे?
    # Agent बोल सकता है "Done! Booked room A at 2pm"
    # या "I've reserved conference room A for tomorrow at 14:00"
    # या "Booked! Room A, April 27, 2:00 PM"
    # सब सही। सब अलग strings.

LLM — ChatGPT, Claude, Gemini के पीछे का दिमाग — non-deterministic है। Same input, different output। हर बार। तुम्हारा assertEqual बेकार है। ये bug नहीं है। ये वही fundamental property है जो agents को useful बनाती है। और यही वो चीज़ है जो उन्हें उन tools से test करना लगभग नामुमकिन बना देती है जिन पर engineers दशकों से भरोसा करते आ रहे हैं।

तीन SDKs इस महीने launch हुए। Test command? शून्य।

तीन बड़े agent SDKs — AI agents बनाने के toolkits — अप्रैल में आए। Anthropic ने 8 अप्रैल को Managed Agents API launch किया। OpenAI ने 15 अप्रैल को अपना Agents SDK update किया। Google ने Cloud Next में 22 अप्रैल को Agent Simulation के साथ ADK 1.0 ship किया। तीनों तुम्हें build-and-run के primitives देते हैं। किसी में भी test command नहीं है।

ये तीन vendors की comparison नहीं है। ये एक pattern है। पूरी industry — हर बड़ी AI lab — ने decide कर लिया कि testing तुम्हारी समस्या है।

इसके बदले में क्या दिया?

Google सबसे करीब आया। Cloud Next पर उन्होंने Agent Evaluation announce किया — एक cloud service जो तुम्हारे agent को task completion, tool usage, और safety पर score करती है। System-level metrics के लिए genuinely useful। लेकिन ये Vertex AI पर चलती है, complexity के हिसाब से हर evaluation पर लगभग $0.50–2.00 लगते हैं, और minutes लगते हैं complete होने में। एक busy repo पर हर pull request पर चलाओ तो सिर्फ eval fees में $300+ प्रति महीना — actual API usage अलग। ये unit test नहीं है। ये एक billing event है।

Anthropic की Managed Agents API में tracing है — तुम्हारे agent ने हर step का log — लेकिन test utilities? शून्य। कोई mock model नहीं, कोई response recording नहीं, कोई assertion helpers नहीं।

OpenAI seed parameter offer करता है partial reproducibility के लिए, लेकिन "partial" का मतलब है "कभी same output, कभी नहीं।" "कभी-कभी" पर CI/CD — automated deployment pipelines — बनाकर दिखाओ।

Behavioral assertion pattern

Community ने खुद जुगाड़ निकाला। Exact text पर assert करने की जगह, behavior patterns पर assert करो — agent ने कौन से tools call किए, किस order में, और जब रुकना चाहिए था तब रुका या नहीं:

def test_booking_agent_behavior(recorded_responses):
    trace = agent.run("Book a room for tomorrow 2pm")
    
    # Tool calls पर assert करो, text output पर नहीं
    assert trace.tool_calls[0].name == "check_availability"
    assert trace.tool_calls[1].name == "create_booking"
    assert "room" in trace.tool_calls[1].args
    assert trace.completed  # infinite loop में नहीं फँसा

Open-source projects जैसे DeepEval और Promptfoo इस approach को आगे बढ़ा रहे हैं। दोनों में से कोई भी तीनों SDKs में से किसी के साथ natively integrate नहीं होता। सब कुछ तुम्हें खुद जोड़ना है।

हर workaround की कीमत है

Model mock करो? तो वो LLM reasoning ही खो जाती है जो agents को valuable बनाती है — तुम एक कठपुतली test कर रहे हो, agent नहीं। Snapshot tests — एक exact response record करो और बाद में compare करो? हर model update या prompt change पर टूट जाते हैं। Cloud evaluations? हर pull request पर minutes और dollars। Behavioral assertions? लिखने में मुश्किल, maintain करना और भी मुश्किल, और basically तुम हर project के लिए scratch से एक testing framework बना रहे हो।

Asli tension ये है: engineers ने testing tools deterministic software के लिए बनाए थे। Agents न deterministic हैं और न ही, सख्ती से कहें तो, traditional sense में software हैं। ये stochastic systems हैं जिन्होंने software का costume पहन रखा है।

अभी असल में क्या करें

कोई vendor तुम्हें नहीं बचाएगा। ये काम करता है, पूरी absurdity के साथ acknowledge करते हुए — तुम 2026 में test infrastructure invent कर रहे हो क्योंकि तीन trillion-dollar companies को इतनी भी तकलीफ नहीं हुई:

  1. Real LLM responses को golden fixtures के तौर पर record करो — saved known-good responses जो तुम tests में replay करते हो बजाय हर बार model को call करने के। हाँ, तुम वो test plumbing हाथ से बना रहे हो जो SDK के साथ आनी चाहिए थी। नहीं, irony हम पर lost नहीं है।

  2. Tool-call sequences पर assert करो, final text पर नहीं। Agent ने check_availability पहले call किया, create_booking बाद में? काफी है। तुम्हारा assertEqual-trained दिमाग चिल्लाएगा। चिल्लाने दो।

  3. Real models के against smoke tests daily cron पर चलाओ, हर pull request पर नहीं। Model drift पकड़ो बिना CI budget जलाए।

  4. Agent tests को integration tests की तरह treat करो — slower, fewer, higher-value — unit tests की तरह नहीं। पाँच अच्छे behavioral tests पचास brittle snapshot tests से बेहतर हैं। जो कोई भी बोले "बस और tests लिखो" उसने कभी ऐसी चीज़ test नहीं की जो हर run पर room bookings के बारे में अलग haiku generate करती है।

# Practical: record & replay pattern
import json

def record_golden_fixture(agent, prompt, path):
    """Real model के against एक बार run करो, trace save करो।"""
    trace = agent.run(prompt)
    with open(path, "w") as f:
        json.dump(trace.to_dict(), f)
    return trace

def test_from_fixture(mock_agent, fixture_path):
    """Saved trace replay करो, structure पर assert करो।"""
    with open(fixture_path) as f:
        golden = json.load(f)
    mock_agent.load_trace(golden)
    result = mock_agent.replay()
    assert [c["name"] for c in result.tool_calls] == [
        "check_availability", "create_booking"
    ]

जो vendor पहले agent test ship करेगा, वो जीतेगा

Django ने web developers को manage.py test से जीता था। Rails ने rails test से। पहला agent SDK जो testing को default primitive बनाएगा — कोई cloud upsell नहीं $0.50 प्रति run वाला, कोई third-party addon नहीं, बस एक local command जो offline काम करे — वो developer layer capture कर लेगा, model quality और tool count से ऊपर।

Untestable agent नया untested microservice है। सब ship करते हैं। सब छह महीने बाद पछताते हैं। अभी, वो agent test command तीनों major SDKs में से किसी में exist नहीं करती।

तुम्हारी test file अभी भी खाली है।