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
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Functions
  • Comparing with other Yandex Cloud services
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Using the invocation context
  • Authentication in the Yandex Cloud API
  1. Developing in Python
  2. Invocation context

Python function invocation context

Written by
Yandex Cloud
Improved by
Mikhail K.
Updated at February 4, 2026
  • Using the invocation context
    • Authentication in the Yandex Cloud API

Invocation context is an object that contains certain execution context parameters as well as invocation parameters for the Python function itself. It is accepted by the call handler as its second argument.

The invocation context contains:

  • function_folder_id: Folder containing the function.
  • function_name: Function ID.
  • function_version: Function version ID.
  • deadline_ms: Unix timestamp of when the function times out, in ms. The get_remaining_time_in_millis() function returns the interval between this timestamp and the current time.
  • memory_limit_in_mb: Amount of memory specified when creating the version, MB.
  • request_id: Request ID.
  • token: Parameters for authentication in the APIs of Yandex Cloud services.

The context also contains the following helper methods:

  • get_remaining_time_in_millis(): Returns the remaining time for the current request, in ms.

Invocation context example.

Using the invocation contextUsing the invocation context

Invocation context is required for a function to have access to environment information so that it can monitor memory usage, track request execution time, and authenticate in the Yandex Cloud service API.

Authentication in the Yandex Cloud APIAuthentication in the Yandex Cloud API

If you specified a service account for a function, the token parameter contains authentication information for that service account:

  • access_token: IAM token.
  • expires_in: Token’s remaining lifetime calculated when calling the function, in seconds.
  • token_type: Token type, e.g., Bearer.

You can also get this information using the metadata service. For more information about this method, see Authentication from within a VM.

Was the article helpful?

Previous
Request handler
Next
Logging
© 2026 Direct Cursus Technology L.L.C.