AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.
LlamaIndex is a framework for building context-augmented generative AI applications with LLMs. AgentOps provides observability into your LlamaIndex applications through automatic instrumentation.
1
Install the AgentOps SDK
pip install agentops
poetry add agentops
2
Install LlamaIndex AgentOps Instrumentation
pip install llama-index-instrumentation-agentops
poetry add llama-index-instrumentation-agentops
3
Add 2 lines of code
Make sure to call agentops.init before calling any openai, cohere, crew, etc models.
from llama_index.core import set_global_handler# NOTE: Feel free to set your AgentOps environment variables (e.g., 'AGENTOPS_API_KEY')# as outlined in the AgentOps documentation, or pass the equivalent keyword arguments# anticipated by AgentOps' AOClient as **eval_params in set_global_handler.set_global_handler("agentops")
Set your API key as an .env variable for easy access.
Here’s a simple example of how to use AgentOps with LlamaIndex:
from llama_index.core import set_global_handlerimport llama_index.core# Set the global handler to AgentOpsset_global_handler("agentops")# Your LlamaIndex application code here# AgentOps will automatically track LLM calls and other operations
For more detailed information about LlamaIndex’s observability features and AgentOps integration, check out the LlamaIndex documentation.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"AgentOps","colors":{"primary":"#a9bed4","light":"#D1E5F7","dark":"#2b3033"},"favicon":"/favicon.png","logo":{"light":"https://mintcdn.com/agentops/FtF2hCpmQ3f-_c4T/images/external/logo/banner-badge-docs-resized-black.png?fit=max\u0026auto=format\u0026n=FtF2hCpmQ3f-_c4T\u0026q=85\u0026s=48bf3cfeb8d204351c58dbf6e9bb8009","dark":"https://mintcdn.com/agentops/FtF2hCpmQ3f-_c4T/images/external/logo/banner-badge-docs-resized-white.png?fit=max\u0026auto=format\u0026n=FtF2hCpmQ3f-_c4T\u0026q=85\u0026s=6314a88da46f2b6181463742ca0e8d5f"},"background":{"decoration":null,"color":{"light":"#f5faff","dark":"#18191a"}},"navbar":{"primary":{"type":"button","label":"Your Dashboard","href":"https://app.agentops.ai"}},"footer":{"socials":{"twitter":"https://twitter.com/agentopsai","discord":"https://discord.gg/UgJyyxx7uc","github":"https://github.com/AgentOps-AI"}},"integrations":{"posthog":{"apiKey":"phc_BrY3H11IViWSoUJ0QFfjBx7kEwIJMT0PjBEXZQmddW","apiHost":"https://us.i.posthog.com"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"agentops","hasAudioNarration":false,"actualSubdomain":"agentops","customDomains":["docs.agentops.ai"],"gitSource":{"type":"github","owner":"agentops-ai","repo":"agentops","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21e60a94a5dc2e6daf338e","collectionId":"a71eb1be-96cd-47d0-be91-d94152b97ee7","schemaVersion":"v2"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a21e60a94a5dc2e6daf338e:success","clientVersion":"0.0.3939","searchFilterCounts":[{"language":"default","tag":"Integrations","count":43},{"language":"default","tag":"Usage","count":18},{"language":"default","tag":"Concepts","count":10},{"language":"default","tag":"Getting Started","count":6},{"language":"default","tag":"Self-Hosting","count":5},{"language":"default","tag":"Other Info","count":2}]},"assistantConfig":{},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","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":"editor-v7-file-tree","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":"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":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","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":"per-site-search-delta","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":"editor-private-page-search","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":"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":"editor-nav-generations","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":"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":"byok-sep-25","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":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","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}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"v1/integrations/llamaindex","slug":"/v1/integrations/llamaindex","pageMetadata":{"title":"LlamaIndex","description":"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.","href":"/v1/integrations/llamaindex"},"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: \"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.\"\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`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Frame,Heading,Note,OptimizedImage,Step,Steps,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://www.llamaindex.ai/`,children:`LlamaIndex`}),` is a framework for building context-augmented generative AI applications with LLMs. AgentOps provides observability into your LlamaIndex applications through automatic instrumentation.`]}),`\n`,_jsxs(Steps,{children:[_jsx(Step,{title:`Install the AgentOps SDK`,children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`pip`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` agentops`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`poetry`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`poetry`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` agentops`})]}),`\n`]})})})]})}),_jsx(Step,{title:`Install LlamaIndex AgentOps Instrumentation`,children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`pip`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` llama-index-instrumentation-agentops`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`poetry`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`poetry`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` llama-index-instrumentation-agentops`})]}),`\n`]})})})]})}),_jsxs(Step,{title:`Add 2 lines of code`,children:[_jsx(Note,{children:_jsxs(_components.p,{children:[`Make sure to call `,_jsx(_components.code,{children:`agentops.init`}),` before calling any `,_jsx(_components.code,{children:`openai`}),`, `,_jsx(_components.code,{children:`cohere`}),`, `,_jsx(_components.code,{children:`crew`}),`, etc models.`]})}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`python`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llama_index.core `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` set_global_handler`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`NOTE`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`: Feel free to set your AgentOps environment variables (e.g., 'AGENTOPS_API_KEY')`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# as outlined in the AgentOps documentation, or pass the equivalent keyword arguments`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# anticipated by AgentOps' AOClient as **eval_params in set_global_handler.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`set_global_handler(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"agentops\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})}),_jsx(Tip,{children:_jsxs(_components.p,{children:[`Set your API key as an `,_jsx(_components.code,{children:`.env`}),` variable for easy access.`]})}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`.env`,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`AGENTOPS_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`YOUR`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` API`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`})]}),`\n`]})})})}),_jsxs(_components.p,{children:[`Read more about environment variables in `,_jsx(_components.a,{href:`/v1/usage/advanced-configuration`,children:`Advanced Configuration`})]})]}),_jsxs(Step,{title:`Run your LlamaIndex application`,children:[_jsxs(_components.p,{children:[`Execute your program and visit `,_jsx(_components.a,{href:`https://app.agentops.ai/drilldown`,children:`app.agentops.ai/drilldown`}),` to observe your LlamaIndex application! 🕵️`]}),_jsx(Tip,{children:_jsx(_components.p,{children:`After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard`})}),_jsx(`div`,{}),_jsx(Frame,{type:`glass`,caption:`Clickable link to session`,children:_jsx(OptimizedImage,{height:`200`,src:`https://github.com/AgentOps-AI/agentops/blob/main/docs/images/link-to-session.gif?raw=true`})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`usage-pattern`,children:`Usage Pattern`}),`\n`,_jsx(_components.p,{children:`Here’s a simple example of how to use AgentOps with LlamaIndex:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llama_index.core `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` set_global_handler`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llama_index.core`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Set the global handler to AgentOps`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`set_global_handler(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"agentops\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Your LlamaIndex application code here`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# AgentOps will automatically track LLM calls and other operations`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`additional-resources`,children:`Additional Resources`}),`\n`,_jsxs(_components.p,{children:[`For more detailed information about LlamaIndex’s observability features and AgentOps integration, check out the `,_jsx(_components.a,{href:`https://docs.llamaindex.ai/en/stable/module_guides/observability/#agentops`,children:`LlamaIndex documentation`}),`.`]}),`\n`,_jsx(`script`,{type:`module`,src:`/scripts/github_stars.js`}),`\n`,_jsx(`script`,{type:`module`,src:`/scripts/scroll-img-fadein-animation.js`}),`\n`,_jsx(`script`,{type:`module`,src:`/scripts/button_heartbeat_animation.js`}),`\n`,_jsx(`script`,{type:`css`,src:`/styles/styles.css`}),`\n`,_jsx(`script`,{type:`module`,src:`/scripts/adjust_api_dynamically.js`})]})}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":{"config":{},"pageMetadata":{"title":"LlamaIndex","description":"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.","href":"/v1/integrations/llamaindex"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Usage Pattern","slug":"usage-pattern","depth":2,"children":[]},{"title":"Additional Resources","slug":"additional-resources","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"agentops","siteName":"AgentOps","title":"LlamaIndex - AgentOps","navMaps":{"firstHrefInVersion":{"v2":{"href":"/v2/integrations/llamaindex","matchLevel":1},"v1":{"href":"/v1/integrations/llamaindex","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-01-06T23:41:06.795Z","originalFileLocation":"v1/integrations/llamaindex.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=\"system\"}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=\"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.\">\u003cmeta data-mint-head name=\"application-name\" content=\"AgentOps\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_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/agentops/z0q4Penmid2LVItK/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"LlamaIndex - AgentOps\">\u003cmeta data-mint-head property=\"og:description\" content=\"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"AgentOps\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.agentops.ai/v1/integrations/llamaindex\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://agentops.mintlify.app/_mintlify/api/og/v2?division=Integrations\u0026amp;title=LlamaIndex\u0026amp;description=AgentOps+works+seamlessly+with+LlamaIndex%2C+a+framework+for+building+context-augmented+generative+AI+applications+with+LLMs.\u0026amp;theme=c0e1e48a6259cb64ea4fc06c\u0026amp;signature=a6705a883f8f4a0f6180934f2780690c8d65710fbb8168e14ac57faf7c5d53bd\">\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=\"LlamaIndex - AgentOps\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://agentops.mintlify.app/_mintlify/api/og/v2?division=Integrations\u0026amp;title=LlamaIndex\u0026amp;description=AgentOps+works+seamlessly+with+LlamaIndex%2C+a+framework+for+building+context-augmented+generative+AI+applications+with+LLMs.\u0026amp;theme=c0e1e48a6259cb64ea4fc06c\u0026amp;signature=a6705a883f8f4a0f6180934f2780690c8d65710fbb8168e14ac57faf7c5d53bd\">\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/agentops/z0q4Penmid2LVItK/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"AgentOps\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#a9bed4\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.agentops.ai/v1/integrations/llamaindex\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/v1/integrations/llamaindex.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.agentops.ai/#organization\",\"name\":\"AgentOps\",\"url\":\"https://docs.agentops.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/agentops/FtF2hCpmQ3f-_c4T/images/external/logo/banner-badge-docs-resized-black.png?fit=max\u0026auto=format\u0026n=FtF2hCpmQ3f-_c4T\u0026q=85\u0026s=48bf3cfeb8d204351c58dbf6e9bb8009\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.agentops.ai#website\",\"name\":\"AgentOps\",\"url\":\"https://docs.agentops.ai\",\"publisher\":{\"@id\":\"https://docs.agentops.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.agentops.ai/v1/integrations/llamaindex#webpage\",\"url\":\"https://docs.agentops.ai/v1/integrations/llamaindex\",\"name\":\"LlamaIndex\",\"description\":\"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.\",\"dateModified\":\"2026-01-06T23:41:06.795Z\",\"isPartOf\":{\"@id\":\"https://docs.agentops.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.agentops.ai/v1/integrations/llamaindex#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.agentops.ai/v1/integrations/llamaindex#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Integrations\",\"item\":\"https://docs.agentops.ai/v1/integrations/agents_sdk\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LlamaIndex\",\"item\":\"https://docs.agentops.ai/v1/integrations/llamaindex\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.agentops.ai/v1/integrations/llamaindex#article\",\"headline\":\"LlamaIndex\",\"name\":\"LlamaIndex\",\"description\":\"AgentOps works seamlessly with LlamaIndex, a framework for building context-augmented generative AI applications with LLMs.\",\"url\":\"https://docs.agentops.ai/v1/integrations/llamaindex\",\"mainEntityOfPage\":{\"@id\":\"https://docs.agentops.ai/v1/integrations/llamaindex#webpage\"},\"dateModified\":\"2026-01-06T23:41:06.795Z\",\"publisher\":{\"@id\":\"https://docs.agentops.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.agentops.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"AgentOps\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"AgentOps","nav":{"global":null,"versions":[{"version":"v2","pages":[{"title":"v2","href":"/v2/integrations/llamaindex"}]},{"version":"v1","groups":[{"group":"","pages":[{"title":"Introduction","mode":"wide","href":"/v1/introduction"}]},{"group":"Getting Started","pages":[{"title":"Quickstart","href":"/v1/quickstart"},{"title":"Examples","mode":"wide","href":"/v1/examples/examples"}]},{"group":"Concepts","pages":[{"title":"Core Concepts","href":"/v1/concepts/core-concepts"},{"title":"Decorators","href":"/v1/concepts/decorators"},{"title":"Sessions","href":"/v1/concepts/sessions"},{"title":"Spans","href":"/v1/concepts/events"},{"title":"Tags","href":"/v1/concepts/tags"}]},{"group":"Integrations","pages":[{"title":"Agents sdk","href":"/v1/integrations/agents_sdk"},{"title":"AI21","href":"/v1/integrations/ai21"},{"title":"Anthropic","href":"/v1/integrations/anthropic"},{"title":"AG2","href":"/v1/integrations/autogen"},{"title":"Camel AI","href":"/v1/integrations/camel"},{"title":"Cohere","href":"/v1/integrations/cohere"},{"title":"CrewAI","href":"/v1/integrations/crewai"},{"title":"Gemini","href":"/v1/integrations/gemini"},{"title":"Groq","href":"/v1/integrations/groq"},{"title":"Haystack","href":"/v1/integrations/haystack"},{"title":"LangChain","description":"AgentOps provides first class support for LangChain applications","href":"/v1/integrations/langchain"},{"title":"LlamaIndex","href":"/v1/integrations/llamaindex"},{"title":"Llama Stack","description":"Llama Stack is a framework from Meta AI for building Agentic applications.","href":"/v1/integrations/llama_stack"},{"title":"LiteLLM","href":"/v1/integrations/litellm"},{"title":"Mistral","href":"/v1/integrations/mistral"},{"title":"MultiOn","href":"/v1/integrations/multion"},{"title":"Ollama","href":"/v1/integrations/ollama"},{"title":"OpenAI","href":"/v1/integrations/openai"},{"title":"REST API","href":"/v1/integrations/rest"},{"title":"smolagents","href":"/v1/integrations/smolagents"},{"title":"SwarmZero","href":"/v1/integrations/swarmzero"},{"title":"TaskWeaver","href":"/v1/integrations/taskweaver"},{"title":"xAI","href":"/v1/integrations/xai"}]},{"group":"Usage","pages":[{"title":"Dashboard","mode":"wide","href":"/v1/usage/dashboard-info"},{"title":"SDK Reference","href":"/v1/usage/sdk-reference"},{"title":"Advanced Configuration","mode":"wide","href":"/v1/usage/advanced-configuration"},{"title":"Tracking LLM Calls","href":"/v1/usage/tracking-llm-calls"},{"title":"Tracking Agents","href":"/v1/usage/tracking-agents"},{"title":"Recording Operations","href":"/v1/usage/recording-operations"}]},{"group":"Other Info","pages":[{"title":"Host Environment Data","href":"/v1/concepts/host-env"}]}]},{"version":"v0","groups":[]}]},"title":"LlamaIndex - AgentOps","buildId":"dpl_5UDDZ9hnigTkoV7QtvQ39eUp84nu","deploymentId":"dpl_5UDDZ9hnigTkoV7QtvQ39eUp84nu","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-CUTvSGqu.js","DynamicMarkdown-BGu84FgU.js","zoom-image-lightbox-ChyC7Hte.js","PlusIcon-DXkY3IBj.js","lightbox-handle-r17bVUz3.js"]}