anth-core-workflow-b

Featured

Build Claude streaming and Message Batches API workflows. Use when implementing real-time streaming responses, SSE event handling, or processing bulk requests with the 50% cheaper Batches API. Trigger with phrases like "claude streaming", "anthropic batch", "message batches api", "SSE events anthropic", "stream claude response".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Anthropic Core Workflow B — Streaming & Batches ## Overview Two complementary patterns: real-time streaming for interactive UIs (SSE events via `POST /v1/messages` with `stream: true`) and the Message Batches API (`POST /v1/messages/batches`) for processing up to 100,000 requests asynchronously at 50% cost reduction. ## Prerequisites - Completed `anth-install-auth` setup - Familiarity with `anth-core-workflow-a` (Messages API basics) - For batches: understanding of async/polling patterns ## Instructions ### Streaming — Python SDK ```python import anthropic client = anthropic.Anthropic() # Method 1: High-level streaming (recommended) with client.messages.stream( model="claude-sonnet-4-20250514", max_tokens=2048, messages=[{"role": "user", "content": "Write a short story about a robot."}] ) as stream: for text in stream.text_stream: print(text, end="", flush=True) # After stream completes, access full message final_message = stream.get_final_message() print(f"\nUsage: {final_message.usage.input_tokens}+{final_message.usage.output_tokens}") # Method 2: Event-level streaming (for custom event handling) with client.messages.stream( model="claude-sonnet-4-20250514", max_tokens=2048, messages=[{"role": "user", "content": "Explain REST APIs."}] ) as stream: for event in stream: if event.type == "content_block_delta": if event.delta.type == "text_delta": print(event.delta.text, end="")...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category