{"id":23202,"library":"agenta","title":"Agenta SDK","description":"Agenta is an open-source LLMOps platform for prompt engineering, evaluation, and deployment. The `agenta` Python SDK (v0.96.10) integrates with your LLM applications to manage prompts, track variants, run evaluations, and collect observability data. Requires Python >=3.11, <4.0. Active development with frequent releases.","status":"active","version":"0.96.10","language":"python","source_language":"en","source_url":"https://github.com/agenta-ai/agenta","tags":["llmops","prompt-engineering","evaluation","observability","agenta"],"install":[{"cmd":"pip install agenta","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Commonly used together for LLM calls, but optional if using other providers.","package":"openai","optional":true}],"imports":[{"note":"","wrong":null,"symbol":"agenta","correct":"import agenta"}],"quickstart":{"code":"import agenta\nimport os\n\n# Initialize with API key (set AGENTA_API_KEY environment variable)\nagenta.init(\n    api_key=os.environ.get(\"AGENTA_API_KEY\", \"\"),\n    host=\"http://localhost:3000\"  # Default self-hosted URL\n)\n\n# Simple prompt call (requires a deployed variant in the Agenta platform)\nfrom agenta import prompt\n\nresponse = prompt.call(\n    app_slug=\"my-app\",\n    variant=\"default\",\n    inputs={\"topic\": \"AI\"}\n)\nprint(response)","lang":"python","description":"Initialize the SDK and call a prompt from a deployed variant."},"warnings":[{"fix":"Migrate to the new invoke API: use POST /api/v1/apps/{app_id}/variants/{variant_id}/invoke with {'inputs': ...}. See migration guide at https://docs.agenta.ai.","message":"In v0.96.0 the REST API endpoints changed significantly. The old `/configs/fetch` endpoint was replaced by a new unified invoke API. If you were using the HTTP API directly, update your requests.","severity":"breaking","affected_versions":">=0.96.0"},{"fix":"Upgrade Python to 3.11+ or pin agenta <0.96.0 if you must use an older Python.","message":"The SDK version 0.96.0 dropped support for Python <3.11. Ensure your environment uses Python 3.11 or later.","severity":"breaking","affected_versions":">=0.96.0"},{"fix":"Always call `agenta.init(api_key=..., host=...)` at the start of your application.","message":"`ag.init()` (or `agenta.init()`) must be called before any tracing or prompt calls. In older versions, tracing could work without init; now it raises a warning (v0.96.3) and may fail in future versions.","severity":"breaking","affected_versions":">=0.96.3"},{"fix":"Replace any calls to `/variant/configs/fetch` with the new unified invoke endpoint.","message":"The `variant/configs/fetch` legacy adapter was re-added in v0.96.2 as a backward-compatibility bridge, but will be removed in a future release. Use the new invoke API instead.","severity":"deprecated","affected_versions":">=0.96.0"},{"fix":"Set the environment variable in your shell or pass `api_key` explicitly: `agenta.init(api_key='...')`.","message":"Environment variable `AGENTA_API_KEY` must be set before calling `agenta.init()`. If not set, the SDK may fail silently or raise an unclear error.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to agenta >=0.96.0 and use `from agenta import prompt`. If using an older version, use `from agenta.sdk import prompt` or check the docs.","cause":"The `prompt` submodule is not directly importable in older SDK versions or if the SDK version is <0.96.0.","error":"ImportError: cannot import name 'prompt' from 'agenta'"},{"fix":"Verify the app_slug and variant name in the Agenta UI. Ensure the variant is deployed (status 'deployed'). Check the host URL.","cause":"The app_slug or variant name is incorrect, or the variant has not been deployed in the Agenta platform.","error":"agenta.exceptions.AgentaAPIError: 404 Not Found: The requested variant does not exist."},{"fix":"Add `agenta.init(api_key=..., host=...)` at the beginning of your code, before any other agenta calls.","cause":"Tracing or prompt calls were attempted before initializing the SDK.","error":"RuntimeError: You must call agenta.init() before using this feature."},{"fix":"Upgrade to agenta >=0.96.0 with `pip install agenta --upgrade`. For older versions, check the docs for the correct init method.","cause":"An older version of agenta (<0.96.0) uses a different initialization pattern (e.g., `agenta.init_app()` or `agenta.sdk.init()`).","error":"AttributeError: module 'agenta' has no attribute 'init'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}