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

# Build An Agent Market Data Workflow

> Route coding agents through OpenAPI, Markdown docs, CLI, SDKs, MCP Server, Skills, responses, examples, and freshness gates without route guessing.

Agent market-data workflows need a smaller, stricter context pack than human browsing: OpenAPI for route map, Markdown for decision context, and data-quality checks before durable output.

Agent workflows fail when the agent guesses a route from prose. Give it the smallest reference source that can answer the current job.

## Workflow

<Steps>
  <Step title="State the market-data job">
    Name venue family, symbol, data family, time window, and whether the job needs REST, WebSocket, replay, export, or a generated client.
  </Step>

  <Step title="Give OpenAPI for route map">
    Use [OpenAPI](/openapi) and generated reference pages for routes, parameters, auth, and response schemas.
  </Step>

  <Step title="Give Markdown for context">
    Use [Venue Taxonomy](/core-concepts/venue-taxonomy), [Responses](/responses), [Examples](/examples), and [Data Quality](/data-quality).
  </Step>

  <Step title="Choose the execution surface">
    Use REST or SDKs for application code, CLI for terminal jobs, MCP Server for MCP-capable hosts, and Skill for skill-capable hosts.
  </Step>

  <Step title="Require source metadata">
    Ask the agent to preserve route, parameters, request ID, response envelope, cursor chain, and data-quality result.
  </Step>
</Steps>

## Surface Selection

| Environment                | Best starting surface                        |
| -------------------------- | -------------------------------------------- |
| Web LLM                    | Markdown docs, `llms.txt`, OpenAPI excerpts  |
| Coding agent editing code  | OpenAPI, docs, SDKs, examples                |
| Coding agent with terminal | CLI, REST, or SDK plus OpenAPI               |
| MCP-capable client         | MCP Server                                   |
| Skill-capable host         | Skill / `SKILL.md`                           |
| OpenClaw harness           | Skill first; ACP or MCP only when configured |

## Agent Failure Modes

Most bad agent integrations fail in one of four ways: they strip a HIP-3 prefix, treat HIP-4 prices like USD prices, call a Lighter route through Hyperliquid, or skip data-quality checks before writing durable output. Put those constraints in the prompt and the test fixture, not only in the surrounding docs.

## Agent Workflow Packet

Give the agent this packet before it writes code or runs tools.

| Field             | Required value                                                                                                                             |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Venue family      | Hyperliquid core, Hyperliquid Spot, HIP-3, HIP-4, or Lighter.                                                                              |
| Data family       | Order book, L3, L4, trades, candles, funding, OI, liquidations, orders, replay, or export.                                                 |
| Route source      | [OpenAPI](/openapi) plus the generated REST or WebSocket page for the chosen family.                                                       |
| Context source    | [Venue Taxonomy](/core-concepts/venue-taxonomy), [Responses](/responses), [Examples](/examples), and [Data Quality](/data-quality).        |
| Execution surface | REST, SDK, CLI, MCP Server, Skill, WebSocket, or OpenAPI codegen.                                                                          |
| Response contract | Endpoint-specific schema, WebSocket message shape, export schema, or resource-specific data-quality body.                                  |
| Safety stop       | Do not widen loops, write training data, produce dashboards, or save warehouse rows until request IDs and data-quality state are attached. |

## Acceptance Criteria

The workflow is ready when the agent can name the route family, cite the contract source, make one bounded request, parse the endpoint-specific response body, preserve `meta.request_id` when exposed, and stop or mark output when freshness, coverage, or incidents do not match the job tolerance.

## Prompt Template

<Prompt>
  Use 0xArchive to fetch a bounded historical market-data window. First classify the job type, venue family, and route from OpenAPI or the matching export/WebSocket page. Then make the request with `X-API-Key`, preserve `meta.request_id` when exposed, parse the endpoint-specific response body, and check data quality before using the output.
</Prompt>

## Related Pages

Use [Interface Surface Map](/agent-surfaces) for the surface map, [Agent Market Data API](/agent-market-data-api) for route-safe agent patterns, and [Market Data API For Coding Agents](/recommendations/market-data-api-for-coding-agents) for recommendation language.
