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 beta)

  • 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).

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 (see design doc Phase B).

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.0b1.tar.gz (78.4 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.0b1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nucleusiq_groq-0.1.0b1.tar.gz
  • Upload date:
  • Size: 78.4 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.0b1.tar.gz
Algorithm Hash digest
SHA256 7508a6dd747162a3e6b6e0367501ae763758a4e9f43310c2db04e5317258c364
MD5 9726c90511237e8c0c180a050dcea8e9
BLAKE2b-256 d8357bde325afe7fc9fd9961233e9ab82844c4874568f8bab0b2f19be7be52c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucleusiq_groq-0.1.0b1.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.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for nucleusiq_groq-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ebac4a97d7cb5bb357b37f2c42da2c56f56f8796cd3d36ff1a8e71937c4d4ca
MD5 9d36f83a2656973c04ed62c1dfe6f903
BLAKE2b-256 40e27ef250caa5e9a3e76aa641c2ba56669c08bbfcec78c6045644be430c4eec

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucleusiq_groq-0.1.0b1-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