Plugin LLM Access
الإضافات LLM Access
Start with meaning, then move to detail.
This lesson explains Plugin LLM Access as part of Hermes internals and extension points. You will learn what it does, when it matters, and the smallest safe test that proves it works.
If you are new, do not memorize names. Focus on three questions: what problem does this solve, what access does it need, and how can you verify the result?
For practice, inspect the first example, identify its effects, run it on test data, and compare the result with the source claim.
For advanced readers, inspect The smallest possible call, A more complete chat example, Structured output, then verify failure modes and version compatibility.
Know Python, Git, and basic project structure before changing code.
A clear outcome before you read.
- Understand Plugin LLM Access without assumed prior knowledge.
- Separate the source description from what still needs testing in your environment.
- Read the first command and identify its inputs and outputs before copying it.
Run any LLM call from inside a plugin via ctx.llm — chat or structured, sync or async. Host-owned auth, fail-closed trust gate, optional JSON Schema validation.
What does the source say, and in what order?
- 01The smallest possible call
Start here to understand the core idea or structure.
- 02A more complete chat example
Read this after the foundation, then connect it to the previous step.
- 03Structured output
Read this after the foundation, then connect it to the previous step.
- 04What this lane gives you
Read this after the foundation, then connect it to the previous step.
- 05Quick start
Read this after the foundation, then connect it to the previous step.
- 06Chat completion — /tldr
Read this after the foundation, then connect it to the previous step.
- 07Structured extraction — /paste-to-tasks
Read this after the foundation, then connect it to the previous step.
- 08When to use which
Read this after the foundation, then connect it to the previous step.
- 09API surface
Read this after the foundation, then connect it to the previous step.
- 10complete()
Finish here to verify the result and special cases.
Copy only after you understand the effect.
That's the whole API in one line. No keys, no provider config, no
SDK initialisation. The plugin runs against whatever provider and
model the user is currently using — when they switch providers, the
plugin follows them automatically.
## A more complete chat example`purpose` is a free-form audit string — it shows up in `agent.log`
and in `result.audit` so operators can see which plugin made which
call. Optional but recommended for anything that fires often.
## Structured output
When the plugin needs a typed answer, switch to the structured lane:The host requests JSON output from the provider, parses it locally
as a fallback, validates against your schema if `jsonschema` is
installed, and hands back a Python object on `result.parsed`. If the
model couldn't produce valid JSON, `result.parsed` is `None` and
`result.text` carries the raw response.
## What this lane gives you
* **One call, four shapes.** `complete()` for chat,
`complete_structured()` for typed JSON, `acomplete()` and
`acomplete_structured()` for asyncio. Same arguments, same result
objects.
* **Host-owned credentials.** OAuth tokens, refresh flows, the
credentiaRead the first command and identify its inputs and outputs before copying it.
Match every command to your installed Hermes version, review the files and accounts it can reach, and use non-sensitive data for the first test. If this explanation differs from the source, the official source wins.