الأكاديمية ← أدلة تطبيقيةتوثيق رسمي · إرشاد عربي

التشغيل عبر AWS Bedrock

AWS Bedrock

متوسط5 دقائق قراءةالدرس 204 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

المزوّد والنموذج: المزوّد هو الشركة التي تشغّل نموذج الذكاء الاصطناعي، والنموذج هو «العقل» الذي يفكّر لـHermes. Hermes نفسه لا يفكّر؛ هو ينظّم العمل ويستدعي النموذج. لذلك اختيار النموذج يحدّد جودة النتيجة وتكلفتها. ستستعمل هنا hermes model وhermes chat، والقراءة نحو 5 دقائق. انتبه: الأغلى ليس دائمًا الأفضل لمهمتك. جرّب مهمة واحدة على نموذجين وقارن، وضع سقفًا للإنفاق من البداية.

9أقسام
7أمثلة برمجية
1جداول
3أوامر
808كلمة من المصدر
الوصف الرسمي في سطر

Use Hermes Agent with Amazon Bedrock — native Converse API, IAM authentication, Guardrails, and cross-region inference

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما المزوّد والنموذج ولماذا قد تحتاجه.
  • تنفّذ hermes model وhermes chat وتفهم ما يحدث بعدها.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط AWS_ACCESS_KEY_ID في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes model
  • hermes chat
  • hermes doctor
متغيرات البيئة
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_PROFILE
  • AWS_REGION
  • AWS_DEFAULT_REGION
  • AWS_BEARER_TOKEN_BEDROCK
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Prerequisites
  2. 02Quick Start
  3. 03Configuration
  4. 04Available Models
  5. 05Switching Models Mid-Session
  6. 06Diagnostics
  7. 07Gateway (Messaging Platforms)
  8. 08Troubleshooting
  9. 09One-Click AWS Deployment
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

Hermes Agent supports Amazon Bedrock as a native provider using the Converse API — not the OpenAI-compatible endpoint. This gives you full access to the Bedrock ecosystem: IAM authentication, Guardrails, cross-region inference profiles, and all foundation models.

Prerequisites

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط AWS_ACCESS_KEY_ID، AWS_SECRET_ACCESS_KEY خارج المحادثة، في بيئة التشغيل.

  • AWS credentials — any source supported by the boto3 credential chain ↗:
  • IAM instance role (EC2, ECS, Lambda — zero config)
  • AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY environment variables
  • AWS_PROFILE for SSO or named profiles
  • aws configure for local development
  • boto3 — install with cd ~/.hermes/hermes-agent && uv pip install -e ".[bedrock]"
  • IAM permissions — at minimum:
  • bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream (for inference)
  • bedrock:ListFoundationModels and bedrock:ListInferenceProfiles (for model discovery)

Quick Start

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes chat، hermes model.

Shell10 أسطر
# Install with Bedrock support
cd ~/.hermes/hermes-agent && uv pip install -e ".[bedrock]"

# Select Bedrock as your provider
hermes model
# → Choose "More providers..." → "AWS Bedrock"
# → Select your region and model

# Start chatting
hermes chat

Configuration

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. الأوامر هنا: hermes model. تضبط AWS_REGION، AWS_DEFAULT_REGION خارج المحادثة، في بيئة التشغيل.

After running hermes model, your ~/.hermes/config.yaml will contain:

YAML7 أسطر
model:
  default: us.anthropic.claude-sonnet-4-6
  provider: bedrock
  base_url: https://bedrock-runtime.us-east-2.amazonaws.com

bedrock:
  region: us-east-2

Region

Set the AWS region in any of these ways (highest priority first):

  1. bedrock.region in config.yaml
  2. AWS_REGION environment variable
  3. AWS_DEFAULT_REGION environment variable
  4. Default: us-east-1

Guardrails

To apply Amazon Bedrock Guardrails ↗ to all model invocations:

YAML7 أسطر
bedrock:
  region: us-east-2
  guardrail:
    guardrail_identifier: "abc123def456"  # From the Bedrock console
    guardrail_version: "1"                # Version number or "DRAFT"
    stream_processing_mode: "async"       # "sync" or "async"
    trace: "disabled"                     # "enabled", "disabled", or "enabled_full"

Model Discovery

Hermes auto-discovers available models via the Bedrock control plane. You can customize discovery:

YAML5 أسطر
bedrock:
  discovery:
    enabled: true
    provider_filter: ["anthropic", "amazon"]  # Only show these providers
    refresh_interval: 3600                     # Cache for 1 hour

Prompt caching (cachePoint)

Hermes automatically applies prompt caching on the Bedrock Converse API path by inserting cachePoint markers after the system prompt, tool definitions, and the latest message. Because sending a cachePoint block to a model that doesn't support it raises a ValidationException, markers are only added for models on a known-good allowlist (Anthropic Claude and Amazon Nova model IDs); unknown models default to no cache markers. Claude models normally use the AnthropicBedrock SDK path, which has its own prompt caching — the Converse cachePoint path covers Nova and the bearer-token Claude fallback. No configuration needed; cache reads/writes show up in usage accounting.

Context-window probing

For models whose context window isn't in Hermes' static table, Hermes can probe the real limit by sending oversized requests at fixed tiers (~1.3M and ~2.2M tokens) and parsing the maximum reported in Bedrock's length-validation error. Probed values feed the same metadata cache as the static table; stale cached entries that under-report a model's window (e.g. entries seeded before a model's 1M window went GA) are dropped automatically in favor of the larger known value.

Available Models

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط. الأوامر هنا: hermes model.

Bedrock models use inference profile IDs for on-demand invocation. The hermes model picker shows these automatically, with recommended models at the top:

ModelIDNotes
Claude Sonnet 4.6us.anthropic.claude-sonnet-4-6Recommended — best balance of speed and capability
Claude Opus 4.6us.anthropic.claude-opus-4-6-v1Most capable
Claude Haiku 4.5us.anthropic.claude-haiku-4-5-20251001-v1:0Fastest Claude
Amazon Nova Prous.amazon.nova-pro-v1:0Amazon's flagship
Amazon Nova Microus.amazon.nova-micro-v1:0Fastest, cheapest
DeepSeek V3.2deepseek.v3.2Strong open model
Llama 4 Scout 17Bus.meta.llama4-scout-17b-instruct-v1:0Meta's latest

Switching Models Mid-Session

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: المزوّد هو الشركة التي تشغّل نموذج الذكاء الاصطناعي، والنموذج هو «العقل» الذي يفكّر لـHermes.

Use the /model command during a conversation:

Text3 أسطر
/model us.amazon.nova-pro-v1:0
/model deepseek.v3.2
/model us.anthropic.claude-opus-4-6-v1

Diagnostics

أوامر تكتبها في الطرفية. افهم ما يفعله الأمر قبل نسخه. الأوامر هنا: hermes doctor.

Shellسطر واحد
hermes doctor

The doctor checks:

  • Whether AWS credentials are available (env vars, IAM role, SSO)
  • Whether boto3 is installed
  • Whether the Bedrock API is reachable (ListFoundationModels)
  • Number of available models in your region

Gateway (Messaging Platforms)

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Bedrock works with all Hermes gateway platforms (Telegram, Discord, Slack, Feishu, etc.). Configure Bedrock as your provider, then start the gateway normally:

Shellسطران
hermes gateway setup
hermes gateway start

The gateway reads config.yaml and uses the same Bedrock provider configuration.

Troubleshooting

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

"No API key found" / "No AWS credentials"

Hermes checks for credentials in this order:

  1. AWS_BEARER_TOKEN_BEDROCK
  2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY
  3. AWS_PROFILE
  4. EC2 instance metadata (IMDS)
  5. ECS container credentials
  6. Lambda execution role

If none are found, run aws configure or attach an IAM role to your compute instance.

"Invocation of model ID ... with on-demand throughput isn't supported"

Use an inference profile ID (prefixed with us. or global.) instead of the bare foundation model ID. For example:

  • ❌ anthropic.claude-sonnet-4-6
  • ✅ us.anthropic.claude-sonnet-4-6

"ThrottlingException"

You've hit the Bedrock per-model rate limit. Hermes automatically retries with backoff. To increase limits, request a quota increase in the AWS Service Quotas console ↗.

One-Click AWS Deployment

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

For a fully automated deployment on EC2 with CloudFormation:

sample-hermes-agent-on-aws-with-bedrock ↗ — creates VPC, IAM role, EC2 instance, and configures Bedrock automatically. Deploy in any region with one click.

اختبار الفهم

4 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. في جدول هذا الدرس، ما «ID» المقابل لـ«Amazon Nova Pro»؟
2. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
3. أي عنوان من التالي لا يظهر في هذا الدرس؟
4. أي مفتاح إعداد يظهر في أمثلة هذا الدرس؟