> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dedaluslabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Artifacts

> Files emitted by an execution on a Dedalus Machine

export const Pop = ({content, children}) => {
  const [open, setOpen] = useState(false);
  const [hoverOpen, setHoverOpen] = useState(false);
  const [isDark, setIsDark] = useState(false);
  const triggerRef = useRef(null);
  const portalRef = useRef(null);
  const closeTimer = useRef(null);
  const isOpen = open || hoverOpen;
  useEffect(() => {
    const probe = () => setIsDark(document.documentElement.classList.contains("dark"));
    probe();
    const obs = new MutationObserver(probe);
    obs.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class"]
    });
    return () => obs.disconnect();
  }, []);
  const onEnter = () => {
    clearTimeout(closeTimer.current);
    setHoverOpen(true);
  };
  const onLeave = () => {
    closeTimer.current = setTimeout(() => setHoverOpen(false), 150);
  };
  useEffect(() => {
    if (!isOpen) return;
    const node = document.createElement("div");
    node.setAttribute("role", "dialog");
    node.textContent = content;
    document.body.appendChild(node);
    portalRef.current = node;
    const dark = document.documentElement.classList.contains("dark");
    Object.assign(node.style, {
      position: "fixed",
      zIndex: "9999",
      maxWidth: "20rem",
      width: "max-content",
      padding: "0.5rem 0.75rem",
      fontSize: "0.875rem",
      lineHeight: "1.55",
      color: dark ? "rgb(244, 244, 245)" : "rgb(39, 39, 42)",
      backgroundColor: dark ? "rgba(24, 24, 27, 0.4)" : "rgba(255, 255, 255, 0.4)",
      backdropFilter: "blur(4px) saturate(160%)",
      WebkitBackdropFilter: "blur(4px) saturate(160%)",
      border: dark ? "1px solid rgba(255, 255, 255, 0.18)" : "1px solid rgba(0, 0, 0, 0.16)",
      boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12)",
      opacity: "0",
      transform: "translateY(-4px)",
      transition: "opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1)"
    });
    const place = () => {
      const r = triggerRef.current?.getBoundingClientRect();
      if (!r || !portalRef.current) return;
      portalRef.current.style.left = `${r.left}px`;
      portalRef.current.style.top = `${r.bottom + 8}px`;
    };
    place();
    requestAnimationFrame(() => {
      node.style.opacity = "1";
      node.style.transform = "translateY(0)";
    });
    node.addEventListener("mouseenter", onEnter);
    node.addEventListener("mouseleave", onLeave);
    window.addEventListener("scroll", place, true);
    window.addEventListener("resize", place);
    return () => {
      window.removeEventListener("scroll", place, true);
      window.removeEventListener("resize", place);
      node.remove();
      portalRef.current = null;
    };
  }, [isOpen, content]);
  useEffect(() => {
    if (!open) return;
    const dismiss = e => {
      const inside = triggerRef.current?.contains(e.target) || portalRef.current?.contains(e.target);
      if (!inside) {
        setOpen(false);
        setHoverOpen(false);
      }
    };
    const onKey = e => e.key === "Escape" && (setOpen(false), setHoverOpen(false));
    document.addEventListener("mousedown", dismiss);
    document.addEventListener("keydown", onKey);
    return () => {
      document.removeEventListener("mousedown", dismiss);
      document.removeEventListener("keydown", onKey);
    };
  }, [open]);
  return <button ref={triggerRef} type="button" onClick={() => setOpen(v => !v)} onMouseEnter={onEnter} onMouseLeave={onLeave} aria-expanded={isOpen} className="cursor-pointer bg-transparent border-0 p-0 text-inherit underline decoration-dotted underline-offset-[3px] transition-colors" style={{
    textDecorationColor: isDark ? "rgb(113, 113, 122)" : "rgb(161, 161, 170)"
  }}>
			{children}
		</button>;
};

<CodeGroup>
  ```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark"}}
  dedalus machines artifacts list --machine-id <machine_id>
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  arts = client.machines.artifacts.list(machine_id="<machine_id>")
  for a in arts.items or []:
      print(a.artifact_id, a.download_url)
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const arts = await client.machines.artifacts.list({ machine_id: "<machine_id>" });
  for (const a of arts.items ?? []) {
    console.log(a.artifact_id, a.download_url);
  }
  ```

  ```go Go theme={"theme":{"light":"github-light","dark":"github-dark"}}
  arts, _ := client.Machines.Artifacts.List(ctx, dedalus.MachineArtifactListParams{
      MachineID: machineID,
  })
  for _, a := range arts.Items {
      fmt.Println(a.ArtifactID, a.DownloadURL)
  }
  ```
</CodeGroup>

An artifact is a file produced by an <Pop content="A command run inside a Dedalus Machine. Executions return status, events, output, and artifacts.">execution</Pop> that you can download after the command finishes. Use `artifact_id` to refer to the file in Dedalus. Use `download_url` to fetch the bytes; if it expires, retrieve the artifact again.

<Accordion title="Parameters">
  <ParamField path="machine_id" type="string" required>
    The machine whose artifacts you want to list.
  </ParamField>

  <ParamField query="cursor" type="string">
    Pagination cursor from a prior page's `next_cursor`.
  </ParamField>

  <ParamField query="limit" type="integer">
    Max items per page.
  </ParamField>
</Accordion>

## Manage artifacts

<CodeGroup>
  ```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark"}}
  dedalus machines artifacts retrieve --machine-id <machine_id> --artifact-id <artifact_id>
  dedalus machines artifacts delete --machine-id <machine_id> --artifact-id <artifact_id>
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  client.machines.artifacts.retrieve(machine_id="<machine_id>", artifact_id="<artifact_id>")
  client.machines.artifacts.delete(machine_id="<machine_id>", artifact_id="<artifact_id>")
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  await client.machines.artifacts.retrieve({
    machine_id: "<machine_id>",
    artifact_id: "<artifact_id>",
  });
  await client.machines.artifacts.delete({
    machine_id: "<machine_id>",
    artifact_id: "<artifact_id>",
  });
  ```

  ```go Go theme={"theme":{"light":"github-light","dark":"github-dark"}}
  client.Machines.Artifacts.Get(ctx, dedalus.MachineArtifactGetParams{
      MachineID:  machineID,
      ArtifactID: "<artifact_id>",
  })
  client.Machines.Artifacts.Delete(ctx, dedalus.MachineArtifactDeleteParams{
      MachineID:  machineID,
      ArtifactID: "<artifact_id>",
  })
  ```
</CodeGroup>

<Accordion title="Parameters">
  <ParamField path="machine_id" type="string" required>
    The machine that owns the artifact.
  </ParamField>

  <ParamField path="artifact_id" type="string" required>
    The artifact to retrieve or delete.
  </ParamField>
</Accordion>
