Yandex Cloud
Search
Discuss with expertTry 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
    • Error handling
    • 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 with the Yandex Cloud APIs
  1. Developing in Python
  2. Invocation context

Python function invocation context

Written by
Yandex Cloud
Improved by
Mikhail K.
Updated at July 2, 2026
View in Markdown
  • Using the invocation context
    • Authentication with the Yandex Cloud APIs

Invocation context is an object that contains certain execution context parameters as well as the parameters for invoking the Python function itself. It is provided to the request handler as the 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, in MB.
  • request_id: Request ID.
  • token: Parameters for authentication with the Yandex Cloud APIs.

The context also contains the following helper methods:

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

You can find an invocation context example here.

Using the invocation contextUsing the invocation context

The invocation context provides the function with access to environment information, enabling it to monitor memory usage, track request execution time, and authenticate with the Yandex Cloud APIs.

Authentication with the Yandex Cloud APIsAuthentication with the Yandex Cloud APIs

If you specified a service account for the 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.