Files
agentrhq__authsome/docs/site/integrations/agents/llamaindex.mdx
Priyansh Khodiyar 71b89fd036 docs(site): adopt skill-driven CLI conventions across the docs
The skill rewrite (PR #284) and README update standardized on
"authsome <command>" (assumes "uv tool install authsome") and on
agent-driven login flows. The docs site still spoke "uvx authsome"
everywhere and didn't surface the auth-error decision tree the
skill teaches. This brings the docs in line.

Four kinds of change in one PR.

1. CLI prefix sweep ("uvx authsome" to "authsome").

Mechanical find/replace across docs/site/ excluding installation.mdx.
812 occurrences updated. installation.mdx keeps the literal "uvx"
references because they explain the one-off run path.

2. installation.mdx rewrite.

- "uv (recommended)" tab leads, with "uv tool install authsome".
- pip second.
- uvx demoted to "one-off, no install" with @latest pattern shown.
- From source unchanged.
- A Note at the top declares: every command in the docs is the
  installed form; uvx users prefix with "uvx authsome@latest".
- All subsequent code blocks updated to bare "authsome".

3. New troubleshooting/auth-errors.mdx page.

Captures the decision tree the skill teaches: 401 -> revoke +
re-login; 403 -> "authsome login --scopes" (not re-registering);
wrong client creds -> "authsome remove" then re-login. Registered
in docs.json under Troubleshooting.

4. quickstart.mdx pivoted to two paths + help reflex.

Path 1: agent-driven. Install the skill, ask the agent to do a
task that needs an external service. The agent runs login itself.
Path 2: CLI-driven. The existing manual walkthrough, preserved.
Adds a Tip about reading "authsome --help" and "authsome <cmd>
--help" before guessing flags.

5. Agent-mode note on the four skill-based integration pages.

claude-code, codex, cursor, opencode each get a one-paragraph Note
clarifying that the agent runs login, opens the browser on the
user's machine for OAuth, and that users should not paste keys
into prompts or pre-run login commands. The four SDK-style
integration pages (langchain, llamaindex, openai-agents-sdk,
anthropic-sdk) are unchanged because their pattern is
developer-driven, not agent-driven.

Verified clean: no "uvx authsome" outside installation.mdx,
docs.json valid, no em-dashes introduced.
2026-05-19 16:12:42 +05:30

81 lines
2.6 KiB
Plaintext

---
title: "LlamaIndex"
sidebarTitle: "LlamaIndex"
description: "Use authsome with LlamaIndex data loaders, LLM clients, and retrievers."
icon: "layer-group"
keywords: ["llamaindex authsome", "llamaindex credentials", "llamaindex oauth", "llamaindex api key"]
---
[LlamaIndex](https://www.llamaindex.ai) connects LLMs to your data through loaders, indexes, and retrievers. Each of those typically needs a credential (LLM API key, data-source token). Run the script under authsome's proxy and the loaders just work.
## Run the whole script under the proxy
```bash
authsome login openai
authsome login github
authsome run -- python my_index.py
```
LlamaIndex's HTTP clients see `OPENAI_API_KEY=authsome-proxy-managed` and similar placeholders. The proxy injects the real value for outbound requests to matched provider hosts. No code changes needed in your script.
## Data-loader credentials
LlamaIndex's data readers cover dozens of services (Notion, Confluence, Slack, Google Drive, etc.). For each one:
- Check `authsome list` for the matching provider name.
- If bundled, log in: `authsome login <provider>`.
- Run your script under `authsome run --`. The reader picks the credential up from its standard env var.
For services not bundled, see [Custom providers](/guides/custom-providers).
## Embedding the library
If you're building a larger orchestrator around LlamaIndex and need explicit per-call control:
```python
from authsome.server.dependencies import create_auth_service
from llama_index.core import Settings
from llama_index.llms.openai import OpenAI
from llama_index.readers.github import GithubRepositoryReader, GithubClient
auth = create_auth_service()
Settings.llm = OpenAI(api_key=auth.get_access_token("openai"))
reader = GithubRepositoryReader(
github_client=GithubClient(auth.get_access_token("github")),
owner="agentrhq",
repo="authsome",
)
docs = reader.load_data(branch="main")
```
Refresh is silent. Re-call `get_access_token` if your process lives long enough to outlast a token's TTL.
## Multi-account
```python
docs_personal = reader_personal.load_data()
docs_work = reader_work.load_data()
```
with:
```python
auth.get_access_token("github", connection="personal")
auth.get_access_token("github", connection="work")
```
See [Multiple connections per provider](/guides/multiple-connections).
## What's next
<Columns cols={2}>
<Card title="Python library" icon="code" href="/reference/python-library">
`AuthService` and the auth-layer API.
</Card>
<Card title="Custom providers" icon="puzzle-piece" href="/guides/custom-providers">
Add a data-source provider authsome doesn't ship.
</Card>
</Columns>