Drop-in <tangle-agent> web component for embedding any Tangle
marketplace agent into any webpage.
<script src="https://unpkg.com/@tangle-network/agent-embed/dist/embed.js"></script>
<tangle-agent slug="tax-freelancer"></tangle-agent>npm install @tangle-network/agent-embedimport '@tangle-network/agent-embed'<tangle-agent slug="tax-freelancer"></tangle-agent>Or call defineTangleAgent() explicitly with a custom tag name.
| Attribute | Required | Default | Purpose |
|---|---|---|---|
slug |
yes | — | Agent's marketplace slug |
host |
no | https://<slug>.tangle.app |
Override base host (BYO custom domain) |
api-key |
no | — | sk-tan-* key; pass or let UI prompt |
model |
no | anthropic/claude-sonnet-4-6 |
Override default model |
theme |
no | auto |
dark / light / auto |
height |
no | 560px |
CSS height |
welcome |
no | agent-specific | Override the welcome banner |
tangle-agent:ready—{ slug, host }after the/healthcheck passestangle-agent:message—{ role, content }on each user / assistant messagetangle-agent:error—{ error, status? }on any failure
el.send(text)— send a message programmaticallyel.clear()— reset the conversationel.setApiKey(key)— update thesk-tan-*key at runtime
The component validates the user's sk-tan-* key against the deployed
agent's /v1/chat/completions endpoint, which in turn validates against
id.tangle.tools. Keys are stored in localStorage per slug for
convenience — pass api-key="..." instead if you don't want that.
Style from the outside via CSS ::part():
tangle-agent::part(header) { background: black; }
tangle-agent::part(send) { background: magenta; }Parts available: root, header, title, status, key-input,
messages, composer, input, send.