Skip to main content

Groq inference provider for the NucleusIQ AI agent framework (official groq Python SDK).

Project description

nucleusiq-groq

Groq inference provider for NucleusIQ: Chat Completions via Groq’s OpenAI-compatible API, using Groq’s official groq Python SDK (AsyncGroq / Groq).

Status: 0.1.0b1 (public beta / pre-release). Requires nucleusiq>=0.7.9.

Design, phased roadmap (Phase A vs B), and API caveats: docs/design/GROQ_PROVIDER.md (repo root).


Install

PyPI (when published):

pip install nucleusiq nucleusiq-groq

Monorepo (editable):

cd src/providers/inference/groq
uv sync --group dev

Core is pulled via [tool.uv.sources] as an editable path dependency; for pip-only local installs, install nucleusiq from src/nucleusiq first, then this package.


Configuration

Variable Purpose
GROQ_API_KEY Required. Groq API key.
GROQ_MODEL Optional. Default for chat/tool examples: llama-3.3-70b-versatile.
GROQ_MODEL_STRUCTURED Optional. Model for json_schema structured output (example 05 defaults to openai/gpt-oss-20b if unset).

Unsupported Chat Completions fields (e.g. logit_bias, messages[].name) are stripped or rejected at the wire layer; see the design doc.


Usage

import asyncio
from nucleusiq.agents import Agent
from nucleusiq.agents.config import AgentConfig, ExecutionMode
from nucleusiq.agents.task import Task
from nucleusiq.prompts.zero_shot import ZeroShotPrompt
from nucleusiq_groq import BaseGroq, GroqLLMParams

async def main() -> None:
    llm = BaseGroq(model_name="llama-3.3-70b-versatile", async_mode=True)
    agent = Agent(
        name="demo",
        prompt=ZeroShotPrompt(),
        llm=llm,
        config=AgentConfig(
            execution_mode=ExecutionMode.DIRECT,
            llm_params=GroqLLMParams(temperature=0.2),
        ),
    )
    await agent.initialize()
    result = await agent.execute(Task(id="1", objective="Capital of France in one short phrase."))
    print(result.output)

asyncio.run(main())

Phase A (this stable line — 0.1.0)

  • BaseGroqcall / call_stream, tool calling, structured output (response_format / Pydantic).
  • GroqLLMParams — typed, extra="forbid"; merges into provider calls.
  • Local function tools — OpenAI-style tool JSON; assistant tool_calls normalized for Groq before each request.
  • Retries — rate-limit and transient errors with exponential backoff; 429 + Retry-After on non-stream and streaming open; errors mapped to NucleusIQ LLMError types.
  • Hosted tool IDsnucleusiq_groq.tools.GROQ_COMPOUND_HOSTED_TOOL_IDS / GROQ_GPT_OSS_HOSTED_TOOL_IDS mirror Groq built-in docs for reference only (not wired into call yet).
  • Native-tool observabilityGroqLLMResponse.server_tool_calls is populated from message.executed_tools when Groq surfaces hosted/compound tool invocations on the chat completion. The core agent loop then auto-emits ToolCallRecord(executed_by="provider") so you can split local vs server cost / latency without provider-specific code. LLMCallRecord.provider="groq" is also populated automatically.
  • Status & gates — promoted from Beta (0.1.0b1) → Stable (0.1.0); classifier Development Status :: 5 - Production/Stable; floor nucleusiq>=0.7.12. 79 unit tests, coverage 92.51% (gate ≥ 90%).

Groq constraints you should respect: per Structured outputs, streaming and tool use are not currently supported with Structured Outputs on the same request — use non-streaming call for response_format, or skip structured output when streaming / using tools.

Not in Phase A: automatic pass-through for compound_custom, Groq Responses API, and remote MCP — these target Phase B (nucleusiq-groq 0.2.x); the observability surface is already wired so Phase B will not require further agent-loop changes.

Integration tests (optional): from src/providers/inference/groq, with GROQ_API_KEY in the environment:

uv run pytest tests/integration -m integration

Default pytest / CI uses -m "not integration" so live calls are optional.


Examples

Runnable agents (real API): examples/README.md.

cd src/providers/inference/groq
uv run python examples/agents/01_groq_direct.py

Development

From this directory:

uv sync --group dev
uvx ruff check nucleusiq_groq tests examples
uvx pyrefly check
uv run pytest

License

MIT — same as the NucleusIQ monorepo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nucleusiq_groq-0.1.0.tar.gz (69.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nucleusiq_groq-0.1.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file nucleusiq_groq-0.1.0.tar.gz.

File metadata

  • Download URL: nucleusiq_groq-0.1.0.tar.gz
  • Upload date:
  • Size: 69.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nucleusiq_groq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8fe886556d2aae3cf41064a54e9da187f829392561c92b6eb272acdb3b09af4
MD5 43babd5791910bae3c44eaae3141e4e6
BLAKE2b-256 9978952397a00f1625ca19a2da6963d03ee8fbcc0d445d2906ac52a94660d06d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucleusiq_groq-0.1.0.tar.gz:

Publisher: publish.yml on nucleusbox/NucleusIQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nucleusiq_groq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nucleusiq_groq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nucleusiq_groq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4df5b5a556618e04b5935f36653692794af678e33ec88e1c3b5e9f942e3a4066
MD5 163c32fd3be02e0d180629d11335ebbc
BLAKE2b-256 ced12bf29d659df374deb32750355d39ec95067ea8cafd3fcfa661f4a9df6f32

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucleusiq_groq-0.1.0-py3-none-any.whl:

Publisher: publish.yml on nucleusbox/NucleusIQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page