Pin user requests using consistent hash based routing.
Imagine a situation where a user is performing some expensive calculation in a request and wants to do so repeatedly over a bunch of API calls. Some of these expensive calculations might have some common computation that you might want to cache between requests. In such a case, you would like to route all the requests from a specific user to a specific replica.One such example is Prefix Caching with model servers like vLLM and SGLang where generating the next reply in a converstation can benefit from the cached computation of the conversation history so far and result in significantly lower latencies.
User 1’s requests are always routed to Pod 1 while User 2’s requests are always routed to Pod 2
Pods can be transitory and sticky routing is best-effort basis
It is important to remember that Kubernetes pods and nodes can be short lived and can be re-scheduled due to external events. It is not advised to put any critical stateful logic in Services.Considering this, sticky routing is best effort basis. In the event of a pinned pod getting deleted / evicted, all sessions pinned to that pod will be re-assigned randomly to other pods. Similarly, in the event of a scale up or scale down, the sessions might be re-assigned to evenly distribute the load.
Enabling Sticky Routing
To enable sticky routing, first in the Service labels section add a special label tfy_sticky_session_header_nameand add a header name against it. For e.g. x-truefoundry-sticky-session-id
Sticky Routing from UI
Passing the header when making requests
Now, your clients can send this header with a unique value for a “session”. For e.g. this value can be a conversation id or user id, anything that identifies a unique session that can benefit from stickyness.For e.g.
from openai import OpenAIclient = OpenAI( base_url="https://my-service.example.com/v1", api_key="<YOUR API KEY>", default_headers={"x-truefoundry-sticky-session-id": "session-id-qnfjk"},)
After the first request, any request that has header x-truefoundry-sticky-session-id: session-id-qnfjk will be routed to the same pod the first request was routed to.
What happens if header is not added?
The request will be routed according to default load balancing policy (random / round robin / least load)
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"TrueFoundry Docs","description":"TrueFoundry documentation — enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways to connect, monitor, and govern agentic AI applications across providers from a unified control plane.","colors":{"primary":"#4f46e5","light":"#4f46e5","dark":"#4f46e5"},"logo":{"light":"https://mintcdn.com/truefoundry/e2uUimEwX30qkWxc/logo/light.svg?fit=max\u0026auto=format\u0026n=e2uUimEwX30qkWxc\u0026q=85\u0026s=6068d83664aeda0239bec2422657dd20","dark":"https://mintcdn.com/truefoundry/e2uUimEwX30qkWxc/logo/dark.svg?fit=max\u0026auto=format\u0026n=e2uUimEwX30qkWxc\u0026q=85\u0026s=c1cb26554a546d84500b40f7057bece8"},"favicon":"https://mintcdn.com/truefoundry/6bbtTt95c1iCcyph/favicon.svg?fit=max\u0026auto=format\u0026n=6bbtTt95c1iCcyph\u0026q=85\u0026s=f55bde34214b38034126d05b08ea16c7","appearance":{"default":"light"},"background":{"decoration":"grid"},"navbar":{"links":[{"href":"https://www.truefoundry.com/book-demo","label":"Book Demo"},{"href":"https://www.truefoundry.com/blog","label":"Blog"}],"primary":{"type":"button","label":"Sign Up","href":"https://www.truefoundry.com/register"}},"footer":{"socials":{"x":"https://twitter.com/truefoundry","linkedin":"https://in.linkedin.com/company/truefoundry"}},"seo":{"metatags":{"og:type":"website","og:site_name":"TrueFoundry Docs","og:image":"https://assets.production.truefoundry.com/logo.svg","og:description":"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane.","description":"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane."}},"icons":{"library":"fontawesome"},"styling":{"codeblocks":"dark","latex":true},"contextual":{"options":["copy","view","chatgpt","claude","mcp","cursor","vscode"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"truefoundry","hasAudioNarration":false,"actualSubdomain":"truefoundry","customDomains":["www.truefoundry.com"],"gitSource":{"type":"github","owner":"truefoundry","repo":"docs-mintlify","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b02f56c3ca2a55c00670bdc","clientVersion":"0.0.4271","searchFilterCounts":[{"language":"default","tag":"AI Gateway","count":253},{"language":"default","tag":"API Reference","count":202},{"language":"default","tag":"Platform","count":198},{"language":"default","tag":"Integrations","count":138},{"language":"default","tag":"LLM Gateway","count":118},{"language":"default","tag":"AI Deployment","count":109},{"language":"default","tag":"Integrate Models","count":51},{"language":"default","tag":"Guardrails and Security","count":48},{"language":"default","tag":"Observability","count":47},{"language":"default","tag":"MCP Servers","count":44}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"[email protected]","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".line-highlight{background:rgb(var(--primary-light)/.7)!important}.tfy-cat-anchor{scroll-margin-top:6rem;margin-block:1.75rem}.line-highlight:before{background:rgb(var(--primary-light)/.7)!important}.line-highlight:after{background:rgb(var(--primary-light)/.7)!important}"}]}
{"page":{"pagePath":"docs/sticky-routing","slug":"/docs/sticky-routing","pageMetadata":{"title":"Sticky Routing","description":"Pin user requests using consistent hash based routing.","href":"/docs/sticky-routing"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Pin user requests using consistent hash based routing.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,hr:`hr`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Frame,Heading,Info,OptimizedImage,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Imagine a situation where a user is performing some expensive calculation in a request and wants to do so repeatedly over a bunch of API calls. Some of these expensive calculations might have some common computation that you might want to cache between requests. In such a case, you would like to route all the requests from a specific user to a specific replica.`}),`\n`,_jsxs(_components.p,{children:[`One such example is `,_jsx(_components.strong,{children:`Prefix Caching`}),` with model servers like `,_jsx(_components.a,{href:`https://docs.vllm.ai/en/stable/automatic_prefix_caching/apc.html`,children:`vLLM`}),` and `,_jsx(_components.a,{href:`https://lmsys.org/blog/2024-01-17-sglang/#backend-automatic-kv-cache-reuse-with-radixattention`,children:`SGLang`}),` where generating the next reply in a converstation can benefit from the cached computation of the conversation history so far and result in significantly lower latencies.`]}),`\n`,_jsx(Frame,{caption:``,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=f43b7865c3720a9d18bdc6a2add6855b`,\"data-og-width\":`2081`,width:`2081`,\"data-og-height\":`802`,height:`802`,\"data-path\":`images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?w=280\u0026fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=d2ef01425ae9343b5295ffa5f3ef46b0 280w, https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?w=560\u0026fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=9e58602120803a8bccceae9d3c53bd62 560w, https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?w=840\u0026fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=6a568427355df0ac7ae95e07a734b57b 840w, https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?w=1100\u0026fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=9e838b4aaf28b6ec11ca2742f2c16752 1100w, https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?w=1650\u0026fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=21c7726280dba56b9e1460ee9c03ac32 1650w, https://mintcdn.com/truefoundry/4MAaF__cLD4iud16/images/502eb0f9-da45c05cfc33c9af97408e2c9919c7096403ceed55bcbbf547ceffbc941be8f3-image.png?w=2500\u0026fit=max\u0026auto=format\u0026n=4MAaF__cLD4iud16\u0026q=85\u0026s=f35bb88acb6b4ca67dec0c1fe2da722d 2500w`})}),`\n`,_jsx(_components.p,{children:`User 1’s requests are always routed to Pod 1 while User 2’s requests are always routed to Pod 2`}),`\n`,_jsxs(Warning,{children:[_jsx(Heading,{level:`3`,id:`pods-can-be-transitory-and-sticky-routing-is-best-effort-basis`,children:`Pods can be transitory and sticky routing is best-effort basis`}),_jsx(_components.p,{children:`It is important to remember that Kubernetes pods and nodes can be short lived and can be re-scheduled due to external events. It is not advised to put any critical stateful logic in Services.`}),_jsxs(_components.p,{children:[`Considering this, sticky routing is best effort basis. In the event of a pinned pod getting deleted / evicted, all sessions pinned to that pod will be re-assigned randomly to other pods. Similarly, in the event of a scale up or scale down, the sessions `,_jsx(_components.strong,{children:`might`}),` be re-assigned to evenly distribute the load.`]})]}),`\n`,_jsx(Heading,{level:`2`,id:`enabling-sticky-routing`,children:`Enabling Sticky Routing`}),`\n`,_jsxs(_components.p,{children:[`To enable sticky routing, first in the Service `,_jsx(_components.code,{children:`labels`}),` section add a `,_jsx(_components.code,{children:`special`}),` label `,_jsx(_components.code,{children:`tfy_sticky_session_header_name`}),`and add a header name against it. For e.g. `,_jsx(_components.code,{children:`x-truefoundry-sticky-session-id`})]}),`\n`,_jsx(Frame,{caption:`Sticky Routing from UI`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=6e27613ab5bd76f708c151b217ea0871`,\"data-og-width\":`1888`,width:`1888`,\"data-og-height\":`1590`,height:`1590`,\"data-path\":`images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?w=280\u0026fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=f239481779b367c15bdd50c6dc1cb368 280w, https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?w=560\u0026fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=d926f8bc5ad7d7c4c81bdab5d201d5bb 560w, https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?w=840\u0026fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=c354d9c0e54f4dbf905ddf3f9c56cc66 840w, https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?w=1100\u0026fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=fbb45489d7d7ac3da8fbcaf838630780 1100w, https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?w=1650\u0026fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=8e133f84bad396eaa355fd7ccf77664d 1650w, https://mintcdn.com/truefoundry/OHzlp6GY5G-JfKle/images/c5a520ad-a1d57bc25d620b3f1f5fea0565ac7a028cbdab69ebc1eb718e01c52d26ac468c-image.png?w=2500\u0026fit=max\u0026auto=format\u0026n=OHzlp6GY5G-JfKle\u0026q=85\u0026s=70bf95fd9bcd0fef227ef0461db878c8 2500w`})}),`\n`,_jsx(Heading,{level:`3`,id:`passing-the-header-when-making-requests`,children:`Passing the header when making requests`}),`\n`,_jsx(_components.p,{children:`Now, your clients can send this header with a unique value for a “session”. For e.g. this value can be a conversation id or user id, anything that identifies a unique session that can benefit from stickyness.`}),`\n`,_jsx(_components.p,{children:`For e.g.`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`cURL`,lines:`true`,numberOfLines:`4`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`curl -X POST https:`}),_jsx(_components.span,{style:{color:`#6A9955`,\"--shiki-dark\":`#6A9955`},children:`//my-service.example.com/v1/chat/completions \\\\`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` -H 'Content-Type: application/json' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` -H 'x-truefoundry-sticky-session-id: session-id-qnfjk' \\\\`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` -d '{`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"messages\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Hi\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}]}'`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`response = requests.post(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"https://my-service.example.com/v1/chat/completions\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`={`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"x-truefoundry-sticky-session-id\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"session-id-qnfjk\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`={`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"messages\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Hi\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}]}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`response.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`OpenAI SDK`,lines:`true`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`client = OpenAI(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` base_url`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"https://my-service.example.com/v1\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` api_key`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cYOUR API KEY>\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` default_headers`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`={`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"x-truefoundry-sticky-session-id\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"session-id-qnfjk\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[`After the first request, any request that has header `,_jsx(_components.code,{children:`x-truefoundry-sticky-session-id: session-id-qnfjk`}),` will be routed to the same pod the first request was routed to.`]}),`\n`,_jsxs(Info,{children:[_jsx(Heading,{level:`3`,id:`what-happens-if-header-is-not-added`,children:`What happens if header is not added?`}),_jsx(_components.p,{children:`The request will be routed according to default load balancing policy (random / round robin / least load)`})]}),`\n`,_jsx(_components.hr,{})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"dark","config":{},"pageMetadata":{"title":"Sticky Routing","description":"Pin user requests using consistent hash based routing.","href":"/docs/sticky-routing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Pods can be transitory and sticky routing is best-effort basis","slug":"pods-can-be-transitory-and-sticky-routing-is-best-effort-basis","depth":3,"children":[]},{"title":"Enabling Sticky Routing","slug":"enabling-sticky-routing","depth":2,"children":[{"title":"Passing the header when making requests","slug":"passing-the-header-when-making-requests","depth":3,"children":[]},{"title":"What happens if header is not added?","slug":"what-happens-if-header-is-not-added","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/truefoundry/9e0085f7ed271180/scripts.js"],"subdomain":"truefoundry","siteName":"TrueFoundry Docs","title":"Sticky Routing - TrueFoundry Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-23T13:21:20.955Z","originalFileLocation":"docs/sticky-routing.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Pin user requests using consistent hash based routing.\">\u003cmeta data-mint-head name=\"application-name\" content=\"TrueFoundry Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Sticky Routing - TrueFoundry Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"TrueFoundry Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.truefoundry.com/docs/sticky-routing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://assets.production.truefoundry.com/logo.svg\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Sticky Routing - TrueFoundry Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://assets.production.truefoundry.com/logo.svg\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"TrueFoundry Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#4f46e5\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.truefoundry.com/docs/sticky-routing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/sticky-routing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.truefoundry.com/#organization\",\"name\":\"TrueFoundry Docs\",\"url\":\"https://www.truefoundry.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/truefoundry/e2uUimEwX30qkWxc/logo/light.svg?fit=max\u0026auto=format\u0026n=e2uUimEwX30qkWxc\u0026q=85\u0026s=6068d83664aeda0239bec2422657dd20\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.truefoundry.com#website\",\"name\":\"TrueFoundry Docs\",\"url\":\"https://www.truefoundry.com\",\"publisher\":{\"@id\":\"https://www.truefoundry.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.truefoundry.com/docs/sticky-routing#webpage\",\"url\":\"https://www.truefoundry.com/docs/sticky-routing\",\"name\":\"Sticky Routing\",\"description\":\"Pin user requests using consistent hash based routing.\",\"dateModified\":\"2026-07-23T13:21:20.955Z\",\"isPartOf\":{\"@id\":\"https://www.truefoundry.com#website\"},\"breadcrumb\":{\"@id\":\"https://www.truefoundry.com/docs/sticky-routing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.truefoundry.com/docs/sticky-routing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Service Deployment\",\"item\":\"https://www.truefoundry.com/docs/introduction-to-a-service\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Configuring your service\",\"item\":\"https://www.truefoundry.com/docs/dockerize-code\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Sticky Routing\",\"item\":\"https://www.truefoundry.com/docs/sticky-routing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.truefoundry.com/docs/sticky-routing#article\",\"headline\":\"Sticky Routing\",\"name\":\"Sticky Routing\",\"description\":\"Pin user requests using consistent hash based routing.\",\"url\":\"https://www.truefoundry.com/docs/sticky-routing\",\"mainEntityOfPage\":{\"@id\":\"https://www.truefoundry.com/docs/sticky-routing#webpage\"},\"image\":\"https://assets.production.truefoundry.com/logo.svg\",\"dateModified\":\"2026-07-23T13:21:20.955Z\",\"publisher\":{\"@id\":\"https://www.truefoundry.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.truefoundry.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"TrueFoundry Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"TrueFoundry Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/sticky-routing.md","siteName":"TrueFoundry Docs","nav":{"global":null,"tabs":[{"tab":"AI Gateway","pages":[{"title":"AI Gateway","href":"/docs/ai-gateway/intro-to-llm-gateway"}]},{"tab":"Agent Platform","pages":[{"title":"Agent Platform","href":"/docs/agent-platform/agent-harness/overview"}]},{"tab":"Platform","pages":[{"title":"Platform","href":"/docs/platform/overview"}]},{"tab":"AI Deployment","groups":[{"group":"Introduction","pages":[{"title":"Introduction to AI Deployment","sidebarTitle":"Overview","href":"/docs/ai-deployment-overview"},{"title":"Key Concepts","href":"/docs/key-concepts"}]},{"group":"Train and Deploy Models","pages":[{"title":"Model Deployment Introduction","sidebarTitle":"Introduction","href":"/docs/model-deployment-introduction"},{"group":"Develop and Iterate","pages":[{"title":"Launch Jupyter Notebook","href":"/docs/launch-notebooks"},{"title":"Launch a SSH Server","href":"/docs/launch-an-ssh-server"},{"title":"Launch Notebook with Spark","href":"/docs/launch-notebook-with-spark"}]},{"title":"Model Registry","href":"/docs/model-registry"},{"group":"Deploy Model As API","pages":[{"title":"Model Deployment Overview","sidebarTitle":"Overview","href":"/docs/model-deployment/overview"},{"title":"HuggingFace","href":"/docs/model-deployment/deploy-model-from-huggingface"},{"title":"Scikit Learn / XGBoost","href":"/docs/model-deployment/deploy-sklearn-xgboost"},{"title":"FastAPI","href":"/docs/model-deployment/deploy-model-fastapi"},{"title":"LitServe","href":"/docs/model-deployment/deploy-litserve"},{"title":"AWS Multi-Model Server","href":"/docs/model-deployment/deploy-model-mms"},{"title":"TorchServe","href":"/docs/model-deployment/deploy-torchserve"},{"title":"TensorFlow Serve (TFServe)","href":"/docs/model-deployment/deploy-tfserve"},{"title":"MlFlow","href":"/docs/model-deployment/deploy-model-mlflow"},{"title":"Migrate Sagemaker Pytorch Endpoint","href":"/docs/model-deployment/migrate-from-sagemaker-pytorch-endpoint"}]}]},{"group":"Service Deployment","pages":[{"title":"Introduction","href":"/docs/introduction-to-a-service"},{"title":"Deploy Your First Service","sidebarTitle":"Getting Started","href":"/docs/deploy-first-service"},{"group":"Configuring your service","pages":[{"title":"Dockerize Your Code","href":"/docs/dockerize-code"},{"title":"Define Ports And Domains","href":"/docs/define-ports-and-domains"},{"title":"Add authentication to your Endpoints","sidebarTitle":"Endpoint Authentication","href":"/docs/endpoint-authentication"},{"group":"Resources","pages":[{"title":"Set Resources","href":"/docs/resources-cpu-memory-storage"},{"title":"Using Fractional GPUs","href":"/docs/using-fractional-gpus"},{"title":"Using TPUs","href":"/docs/using-tpus"}]},{"title":"Environment Variables \u0026 Secrets","sidebarTitle":"Environment Variables And Secrets","href":"/docs/environment-variables-and-secrets"},{"title":"Autoscaling Overview","sidebarTitle":"Autoscaling","href":"/docs/autoscaling-overview"},{"title":"Pause / Resume Service","href":"/docs/pause-resume-service"},{"title":"Scale Service to 0","href":"/docs/scale-service-to-0"},{"title":"Liveness/Readiness Probe","href":"/docs/liveness-readiness-probe"},{"title":"Rollout Strategy","href":"/docs/rollout-strategy"},{"title":"Access Cloud Services Like S3","href":"/docs/access-data-from-s3-or-other-clouds-services"},{"title":"Download Models/Artifacts","href":"/docs/download-and-cache-models"},{"title":"Redirect And Mirror Traffic","href":"/docs/intercepts"},{"title":"Kustomize Support","description":"Use Kustomize to patch or add Kubernetes resources to your TrueFoundry deployment configurations.","href":"/docs/kustomize"},{"title":"Sticky Routing","href":"/docs/sticky-routing"},{"title":"Mounting Volumes/Files","description":"Mount volumes, secrets, or configuration strings to your services for persistent data and runtime settings.","href":"/docs/mounting-volumes-service"},{"title":"Deploy a Service Programmatically","sidebarTitle":"Deploy Programatically","href":"/docs/deploy-service-programatically"},{"title":"Set Up CI/CD","href":"/docs/setting-up-cicd-for-your-service"},{"title":"Update, Rollback, Promote","href":"/docs/update-rollback-promote-your-service"},{"title":"View Logs, Metrics And Events","href":"/docs/monitor-your-service"},{"title":"Log \u0026 Monitor Custom Metrics","href":"/docs/log-monitor-custom-metrics"},{"title":"Setup Alerts","href":"/docs/setup-alerts"},{"title":"Docker Build Secrets","href":"/docs/docker-build-secrets"}]}]},{"group":"Job Deployment","pages":[{"title":"Jobs Introduction","sidebarTitle":"Introduction","href":"/docs/introduction-to-a-job"},{"title":"Deploy Job from GitHub","sidebarTitle":"Getting Started","href":"/docs/deploy-job-from-a-public-github-repository"},{"group":"Configuring your Job","pages":[{"title":"Parameterize A Job","href":"/docs/deploy-a-job-with-additional-parameters"},{"title":"Env Variables \u0026 Secrets for Jobs","sidebarTitle":"Environment Variables And Secrets","href":"/docs/environment-variables-and-secrets-jobs"},{"title":"Mounting Volumes","href":"/docs/mounting-volumes-job"},{"title":"Set Retries And Timeout","href":"/docs/retries-and-timeout"},{"title":"Set Concurrency Limit","href":"/docs/concurrency-limits"},{"title":"Deploy a Job Programmatically","sidebarTitle":"Deploy Programatically","href":"/docs/deploy-job-programatically"},{"title":"Monitor Your Job","href":"/docs/monitor-your-job"},{"title":"Access Data From S3 Or Other Clouds","href":"/docs/access-data-from-s3-or-other-clouds-jobs"},{"title":"Add Alerts To Your Job","href":"/docs/add-alerts-to-your-job"},{"title":"Logging Data in Job Runs","href":"/docs/job-runs-and-logging"}]},{"group":"Configuring your Spark Job","pages":[{"title":"Use blob storage with your Spark job","href":"/docs/deploy-a-spark-job-with-blob-storage"},{"title":"JVM metrics for Spark jobs","href":"/docs/spark-job-jvm-metrics"}]}]},{"group":"LLM Deployment","pages":[{"title":"Deploying LLMs","href":"/docs/deploying-an-llm-model-from-the-model-catalogue"},{"title":"Deploying NVIDIA NIM Models","href":"/docs/deploying-nvidia-nims"},{"title":"Benchmarking LLMs","href":"/docs/benchmarking-llms"}]},{"group":"LLM Finetuning","pages":[{"title":"Finetuning LLMs","href":"/docs/finetuning-a-model-from-the-model-catalogue"}]},{"group":"MCP Server Deployment","pages":[{"title":"MCP Server Deployment Overview","sidebarTitle":"Overview","href":"/docs/mcp-server-deployment/mcp-server-deployment-overview"},{"title":"Deploy MCP Server From Code","sidebarTitle":"Deploy From Code","href":"/docs/mcp-server-deployment/deploy-mcp-server-from-code"},{"title":"Deploy MCP Server from npx/uvx","sidebarTitle":"Deploy from npx/uvx","href":"/docs/mcp-server-deployment/deploy-mcp-server-from-npx-uvx"}]},{"group":"Workflow Deployment","pages":[{"title":"Introduction To Workflow","href":"/docs/introduction-to-workflow"},{"title":"Creating Your First Workflow","href":"/docs/creating-your-first-workflow"},{"title":"Interacting With Workflow","href":"/docs/interacting-with-workflow"},{"title":"Workflow Concepts","href":"/docs/workflow-concepts"},{"group":"Guides","pages":[{"title":"Creating A Workflow With Different Container Images","href":"/docs/creating-a-workflow-with-gpu-and-non-gpu-image"},{"title":"Using Dockerfile For Python Function Task","href":"/docs/python-function-tasks-with-dockefile"},{"title":"Using Raw Container Task","href":"/docs/container-task"},{"title":"Adding Environment Variable","href":"/docs/adding-environment-variable"},{"title":"Configuring Resources","href":"/docs/configuring-resources"},{"title":"Creating A Conditional Task","href":"/docs/conditional-task"},{"title":"Creating A Map Task","href":"/docs/creating-a-map-task"},{"title":"Creating A Cron Workflow","href":"/docs/cron-workflow"},{"title":"Creating A Spark Task","href":"/docs/spark-task"},{"title":"Creating A Databricks Task","href":"/docs/databricks-task"},{"title":"Creating A Snowflake Task","href":"/docs/snowflake-task"},{"title":"Task Config","href":"/docs/task-config"},{"title":"Attaching Mounts","href":"/docs/attaching-mounts"},{"title":"Passing Files/Artifacts Between Tasks","href":"/docs/passing-filesartifacts-between-tasks"},{"title":"Example Of Task Config With Different Parameters","href":"/docs/example-of-task-config-with-different-parameters"},{"title":"Adding Retries And Handling Failures","href":"/docs/adding-retries-and-handling-failures"},{"title":"Running Workflow Locally","href":"/docs/running-workflow-locally"},{"title":"Adding Alerts For Workflow","href":"/docs/adding-alerts-for-workflow"},{"title":"Handling Failure using Failure Task/Node","href":"/docs/handling-workflow-failure"},{"title":"Recovering a Failed Workflow Execution","href":"/docs/recovering-workflow-execution"}]}]},{"group":"Async Service Deployment","pages":[{"title":"Introduction to Async Service","href":"/docs/introduction-to-async-service"},{"title":"Deploy your first Async Service","href":"/docs/deploy-your-first-asyncservice"},{"group":"Configure async service","pages":[{"title":"Configure Ports","href":"/docs/configure-ports"},{"title":"Configure Queue","href":"/docs/configure-queue"},{"title":"Autoscaling","href":"/docs/autoscaling"},{"title":"Configure Sidecar","href":"/docs/configure-sidecar"}]},{"group":"Queue Integrations","pages":[{"title":"AWS SQS","href":"/docs/aws-sqs"}]},{"title":"Monitor Your Async Service","href":"/docs/monitoring-your-async-service"}]},{"group":"Volumes","pages":[{"title":"Introduction to Volume","href":"/docs/introduction-to-volume"},{"title":"Creating And Using Volumes","href":"/docs/creating-a-volume"}]},{"group":"Experiment Tracking","pages":[{"title":"ML Repo: Getting Started","sidebarTitle":"Getting Started","href":"/docs/ml-repo-quickstart"},{"title":"Create Runs and Log Data","href":"/docs/create-run"},{"title":"Artifacts and Artifact Versions","href":"/docs/log-artifacts"},{"title":"Models and Model Versions","href":"/docs/log-models"},{"title":"Huggingface Trainer Callback","href":"/docs/huggingface-trainer-callback"}]},{"group":"Advanced Features","pages":[{"title":"Secret Management","href":"/docs/manage-secrets"},{"title":"Deployment Guardrails and Policies","href":"/docs/applying-custom-policies"},{"title":"Deploy Helm Charts","href":"/docs/deploy-helm-charts"},{"title":"Deploy Kubernetes Manifests","href":"/docs/deploy-kubernetes-manifests"},{"title":"Ingress Controller Configuration","href":"/docs/ingress-controller-configuration"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/docs/truefoundry_sdk"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/docs/ai-gateway/ecosystem"}]},{"tab":"Changelog","groups":[{"group":" ","pages":[{"title":"Changelog","href":"/docs/changelog"},{"group":"Announcements","pages":[{"title":"Deprecation of Rate Limiting V1 — 2nd November, 2026","href":"/docs/change-announcements/deprecation-of-rate-limiting-v1"},{"title":"Move to Named Guardrail Policies — v0.179","href":"/docs/change-announcements/named-guardrails-config-v0.179"},{"title":"Perplexity Models Move to the Agent API","href":"/docs/change-announcements/perplexity-agent-api-migration"},{"title":"Plan-Based Feature Gating — v0.174.0","href":"/docs/change-announcements/plan-based-feature-gating-v0.174.0"},{"title":"Agent Builder Moving to Trueforge \u0026 Agent APIs Deprecated — v0.172","href":"/docs/change-announcements/agents-moving-to-trueforge"},{"title":"Removing Collaborators from Resources — v0.172.0","href":"/docs/change-announcements/removing-collaborators-from-resources"},{"title":"Deprecation of MCP tool_settings — 26th October, 2026","href":"/docs/change-announcements/deprecation-of-mcp-tool-settings"},{"title":"Deprecation of truefoundry \u003c 0.17.0 and truefoundry-sdk \u003c 0.4.0 packages","sidebarTitle":"Deprecation of truefoundry \u003c 0.17.0 and truefoundry-sdk \u003c 0.4.0 packages - 19th August 2026","href":"/docs/change-announcements/deprecation-of-truefoundry-below-0.17-and-api-ml"},{"title":"Minimum Python Version Raised to 3.10 — truefoundry v0.17.0","href":"/docs/change-announcements/python-3.10-minimum-truefoundry-cli-v0.17.0"},{"title":"Budget Limiting V2 — v0.158.0","href":"/docs/change-announcements/budget-limiting-v2-v0.158.0"},{"title":"Deprecation of MCP Servers APIs — 30th September, 2026","href":"/docs/change-announcements/deprecation-of-mcp-servers-v1-apis"},{"title":"Deprecation of Images and Plots in Job Runs — v0.156.0","href":"/docs/change-announcements/deprecation-of-images-and-plots-in-job-runs-v0.156.0"},{"title":"Moving to External Secrets Operator for Secrets Management — v0.151.5","href":"/docs/change-announcements/moving-to-eso-for-secret-management-v0.151.5"},{"title":"MCP DCR client_id \u0026 Redirect URL Validation — v0.148","href":"/docs/change-announcements/mcp-dcr-client-id-validation-v0.148"},{"title":"Deprecation of Routing Config","href":"/docs/change-announcements/deprecation-of-routing-config"},{"title":"Identity and Access Revamp — v0.143","href":"/docs/change-announcements/identity-and-access-revamp-v0.143"},{"title":"AI Gateway Metrics Rename — v0.136","href":"/docs/change-announcements/refactoring-of-ai-gateway-metrics"},{"title":"Deprecation of MCP Servers in Prompts","href":"/docs/change-announcements/deprecation-of-mcp-servers-in-prompts"},{"title":"Deprecation of Common Tools in Playground and Settings — v0.135","href":"/docs/change-announcements/deprecation-of-common-tools-v0-135-0"},{"title":"x-tfy-routing-config Header Removal — v0.133","href":"/docs/change-announcements/routing-config-header-removal-v0.133"},{"title":"Simplified GitOps CI/CD with tfy apply — v0.132","href":"/docs/change-announcements/simplified-gitops-cicd-v0.132"},{"title":"Legacy MCP OAuth Routes Removal — v0.134","href":"/docs/change-announcements/legacy-mcp-oauth-routes-removal"},{"title":"MCP Gateway URL and Transport Changes — v0.130","href":"/docs/change-announcements/mcp-gateway-url-transport-v0.130"},{"title":"Gemini CLI Model Registration Requirement — v0.118","href":"/docs/change-announcements/gemini-cli-model-registration-v0.118"},{"title":"Guardrails YAML Schema Change — v0.116","href":"/docs/change-announcements/guardrails-yaml-schema-change-v0.116"},{"title":"MCP Server Groups Removal — v0.112","href":"/docs/change-announcements/mcp-server-groups-removal-v0.112"}]}]}]}]},"basePath":"","title":"Sticky Routing - TrueFoundry Docs","deploymentId":"dpl_Em2U4NQQ2N2DE3HPbPUJVZLnAtvc","buildId":"dpl_Em2U4NQQ2N2DE3HPbPUJVZLnAtvc","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-DMn5ZJp6.js","DynamicMarkdown-5yMTCLas.js","zoom-image-lightbox-BUkqX3JF.js","lightbox-handle-r17bVUz3.js"]}