Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
agent / agent-anthropic-response-2Built by davevia claude-codeRuns on Liberasnew version of agent-anthropic-response

Anthropic Messages API: response, with provider turns

A new version of agent-anthropic-response (it supersedes it): exactly its rules, and the result's extra is some(the response's whole content array as compact JSON, object keys in ascending byte order of their UTF-8 at every level) (ADR 0064), so the turn can be replayed with its thinking blocks and signatures.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init agent-anthropic-response-2 --lang rust
cd agent-anthropic-response-2 && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)28 lines›
agent-anthropic-response-2.wit
package root:component;

world root {
  import liberas:agent/types@0.1.0;

  export liberas:agent/wire-response@0.1.0;
}
package liberas:agent@0.1.0 {
  interface types {
    record tool-call {
      id: string,
      name: string,
      arguments: string,
    }

    record model-output {
      text: string,
      tool-calls: list<tool-call>,
      extra: option<string>,
    }
  }
  interface wire-response {
    use types.{model-output};

    parse: func(body: string) -> result<model-output, string>;
  }
}
Test vectors19›
agent-anthropic-response-2.cases.json
[
  {
    "args": {
      "body": "{\"id\":\"msg_1\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"Hello.\"}],\"stop_reason\":\"end_turn\"}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"text\",\"text\":\"Reading \"},{\"type\":\"tool_use\",\"id\":\"toolu_1\",\"name\":\"read-file\",\"input\":{\"path\":\"a\",\"opts\":{\"b\":[1,{\"z\":1,\"a\":2}]}}},{\"type\":\"text\",\"text\":\"now\"}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"thinking\",\"thinking\":\"…\"},{\"type\":\"tool_use\",\"id\":\"toolu_1\",\"name\":\"f\",\"input\":{}}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"error\",\"error\":{\"type\":\"overloaded_error\",\"message\":\"Overloaded\"}}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"error\",\"error\":{\"type\":\"x\"}}"
    }
  },
  {
    "args": {
      "body": "not json at all"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\"}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"tool_use\",\"name\":\"f\",\"input\":{}}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"text\",\"text\":5}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"tool_use\",\"id\":\"t\",\"name\":\"f\",\"input\":\"a string input\"}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"text\",\"text\":\"é\\u0000\"}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"tool_use\",\"id\":\"a\",\"name\":\"f\",\"input\":{\"z\":1,\"a\":[1,2,{\"y\":null,\"b\":\"x\"}]}},{\"type\":\"tool_use\",\"id\":\"b\",\"name\":\"g\",\"input\":{}}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"text\",\"text\":\"one \"},{\"type\":\"text\",\"text\":\"two\"}],\"stop_reason\":\"max_tokens\",\"usage\":{\"input_tokens\":1}}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"tool_use\",\"id\":\"n\",\"name\":\"num\",\"input\":{\"f\":1.5,\"i\":2,\"big\":12345678901234,\"neg\":-0.25,\"e\":1e+21}}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"server_tool_use\",\"id\":\"s\",\"name\":\"web_search\",\"input\":{}},{\"type\":\"web_search_tool_result\",\"tool_use_id\":\"s\",\"content\":[]},{\"type\":\"text\",\"text\":\"found\"}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"tool_use\",\"id\":\"u\",\"name\":\"f\",\"input\":{\"키\":\"값\",\"\\\"q\\\"\":\"\\\\\"}}]}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"thinking\",\"thinking\":\"The file first.\",\"signature\":\"sig-1\"},{\"type\":\"text\",\"text\":\"Reading.\"},{\"type\":\"tool_use\",\"id\":\"c1\",\"name\":\"read-file\",\"input\":{\"path\":\"a\"}}],\"stop_reason\":\"tool_use\"}"
    }
  },
  {
    "args": {
      "body": "{\"type\":\"message\",\"content\":[{\"type\":\"redacted_thinking\",\"data\":\"opaque\"},{\"type\":\"text\",\"text\":\"ok\"}]}"
    }
  }
]
Versions (units)1›
  1. v1by dave5ce0b4d63estable 5.1.0latestconfirmed10/23/2026
Verification8›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 19 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 200,000,000 instructions.
  • A new version of agent-anthropic-response: its reference answers every case of agent-anthropic-response as it does. Once this and everything it imports are built, it runs in place of agent-anthropic-response, at the same URL.
  • Already built: a component that passes and uses at most 0.9× the current one's fuel on the same cases replaces it, and earns the spec's shares in proportion to the saving.
  • Found an input where the current component disagrees with the spec? Submit it as a case (API or `liberas case`): it joins the vectors for good and earns 10% of the spec's shares. A component that then passes replaces the broken one for 25%.