Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex AI Studio
  • Getting started with Model Gallery
    • About Yandex AI Studio
    • Yandex Workflows
    • Quotas and limits
    • Terms and definitions
    • All guides
    • Disabling request logging
    • Getting an API key
      • Creating a text agent with web search
      • Creating a text agent with file search
      • Creating a text agent with search based on pre-created chunks
      • Working with the Vector Store search index
  • Switching from the AI Assistant API to Responses API
  • Compatibility with OpenAI
  • Access management
  • Pricing policy
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Getting started
  • Create
  1. Step-by-step guides
  2. AI Search
  3. Creating a text agent with web search

Creating a text agent with web search

Written by
Yandex Cloud
Updated at December 23, 2025
  • Getting started
  • Create

In Yandex AI Studio, you can create a text agent that will access information from the internet to generate a response.

Getting startedGetting started

To use an example:

Python

Get API authentication credentials as described in Authentication with the Yandex AI Studio API.

CreateCreate

Python
  1. Create a search index.

  2. Create a file named index.py and add the following code to it:

    import openai
    import json
    
    YANDEX_CLOUD_FOLDER = "..."
    YANDEX_CLOUD_API_KEY = "..."
    YANDEX_CLOUD_MODEL = "yandexgpt"
    
    client = openai.OpenAI(
        api_key=YANDEX_CLOUD_API_KEY,
        base_url="https://rest-assistant.api.cloud.yandex.net/v1",
        project=YANDEX_CLOUD_FOLDER
    )
    
    response = client.responses.create(
        model=f"gpt://{YANDEX_CLOUD_FOLDER}/{YANDEX_CLOUD_MODEL}",
        input="Give me a quick overview of LLM news for September 2025.",
        tools=[
            {
                "web_search": {
                    "filters": {
                        "allowed_domains": [
                            "habr.ru"
                        ]
                    },
                    "user_location": {
                        "region": "213",
                    }
                }
            }
        ],
        temperature=0.3,
        max_output_tokens=1000
    )
    
    # Response text
    print("Response text:")
    print(response.output_text)
    print("\n" + "=" * 50 + "\n")
    
    # Full response
    print("Full response (JSON):")
    print(json.dumps(response.model_dump(), indent=2, ensure_ascii=False))xs
    
  3. Save authentication data into environment variables:

    export YANDEX_CLOUD_FOLDER=<folder_ID>
    export YANDEX_CLOUD_API_KEY=<API_key>
    export VECTOR_STORE_ID=<search_index_ID>
    
  4. Run the file you created:

    python index.py
    

Was the article helpful?

Previous
Creating a voice agent via Realtime API
Next
Creating a text agent with file search
© 2025 Direct Cursus Technology L.L.C.