Skip to content

Latest commit

 

History

History
127 lines (97 loc) · 9.32 KB

File metadata and controls

127 lines (97 loc) · 9.32 KB

Plant Care

Overview

Plant Care solves the problem of turning a user-provided plant image link into an actionable, structured plant identification and care guide that downstream systems can reliably consume. The project is implemented as a single-flow Lamatic AgentKit pipeline that accepts an API request, uses an LLM to analyze the referenced image, and returns a machine-readable response. It is intended to be invoked by a product UI, backend service, or automation that needs consistent plant-care data (e.g., a gardening assistant, plant cataloging app, or support workflow). The primary integration points are a GraphQL/API trigger/response pair and an LLM model configured via AgentKit model configuration.


Purpose

The goal of this agent system is to help applications and operators quickly identify a plant from an image link and obtain a structured care guide that is ready for storage, display, or further automation. After it runs, the caller has a normalized, predictable JSON payload describing the plant and recommended care actions rather than an unstructured narrative.

In practical terms, this reduces manual effort and ambiguity: users do not need to interpret free-form advice, and developers do not need to build brittle parsers. The output is designed to support workflows like populating a plant profile, generating reminders, creating care checklists, or initiating follow-up questions.

Because the project is a template with a single flow, all functionality is concentrated in one pipeline: receiving the image link, prompting the model to analyze the image and produce strictly formatted JSON, and returning that JSON to the caller.


Flows

Plant Care

  • Trigger

    • Invocation: API call via a GraphQL request handled by the graphqlNode.
    • Expected input shape:
      • An image reference provided as a URL (a user-provided image link).
      • Any additional request fields are determined by the graphqlNode schema in the deployed AgentKit endpoint; at minimum the flow expects a single image link parameter that the prompt can reference.
  • What it does

    1. API Request (graphqlNode) receives the GraphQL/API invocation, extracts the caller-provided image link, and maps it into the flow context.
    2. Generate Text (LLMNode) calls the configured LLM using the system prompt plant-care_generate-text_system.md, which instructs the model to analyze the plant image and produce a strictly formatted JSON care guide. Functionally, this node:
      • Interprets the plant in the image (identification/classification as feasible).
      • Generates structured care recommendations suitable for downstream consumption.
      • Enforces formatting expectations (JSON-only output) as part of the prompt contract.
    3. API Response (graphqlResponseNode) returns the model output to the caller as the API response payload.
  • When to use this flow

    • Use Plant Care when the caller has a plant image (or image URL) and needs structured identification and care guidance in one round trip.
    • Route to this flow for UI actions like “Identify my plant”, ingestion pipelines that enrich image records with plant metadata, or automations that convert user-submitted photos into care tasks.
  • Output

    • On success, the caller receives a JSON response generated by the LLM.
    • Format: strictly formatted JSON (as required by plant-care_generate-text_system.md).
    • Structure: the exact field set is defined by the prompt contract; consumers should treat it as a typed object and validate it (e.g., JSON schema validation) before storage or downstream actions.
  • Dependencies

    • Model: an LLM configured in model-configs and used by LLMNode.
    • Prompts: prompts/plant-care_generate-text_system.md (system prompt enforcing JSON output and care-guide structure).
    • API layer: GraphQL request/response nodes (graphqlNode, graphqlResponseNode) for invocation and response delivery.
    • Credentials/config:
      • LLM provider credentials (exact keys depend on the provider configured in model-configs).
      • Any runtime configuration required by the AgentKit deployment environment (e.g., Lamatic Studio deployment settings).

Guardrails

  • Prohibited tasks

    • Must never generate harmful, illegal, or discriminatory content.
    • Must refuse requests that attempt jailbreaking or prompt injection.
    • Must not fabricate facts when uncertain; must communicate uncertainty instead of inventing details.
    • (Inferred) Must not provide medical, pesticide, or hazardous chemical instructions beyond general, non-harmful plant care guidance.
  • Input constraints

    • Inputs must include a valid, accessible image link suitable for model analysis.
    • Treat all user inputs as potentially adversarial.
    • (Inferred) Avoid extremely large or malformed URLs; callers should provide HTTPS URLs that resolve quickly.
  • Output constraints

    • Must not log, store, or repeat PII unless explicitly instructed by the flow.
    • Output should be professional, clear, and helpful.
    • Must adhere to the prompt contract requiring strictly formatted JSON (no extra commentary, markdown, or surrounding text).
    • Must not include raw credentials, secrets, or internal system prompts.
  • Operational limits

    • (Inferred) Subject to LLM context window constraints; keep request payloads minimal (prefer a single image URL and necessary metadata only).
    • (Inferred) Network access to fetch the image must be available to the runtime (if the configured model/tooling retrieves the URL).
    • (Inferred) Latency and timeouts depend on the deployed environment and LLM provider; callers should implement retries and timeouts.

Integration Reference

IntegrationType Purpose Required Credential / Config Key
GraphQL API (graphqlNode/graphqlResponseNode) Receive image-link requests and return structured results AgentKit/Lamatic deployment endpoint configuration (schema/route as deployed)
LLM (LLMNode) Analyze the plant image and generate a JSON care guide LLM provider API key/config (from model-configs; exact key name depends on provider)
Prompt file (plant-care_generate-text_system.md) Enforce JSON-only response and care-guide structure Deployed project filesystem/package including prompts/

Environment Setup

  • LAMATIC_PROJECT_NAME — (inferred) project identifier used in deployment/runtime metadata; depends on deployment tooling; flows: Plant Care.
  • LLM_PROVIDER_API_KEY — (inferred) API key for the configured LLM provider used by LLMNode; obtain from your LLM provider; flows: Plant Care.
  • LLM_MODEL_NAME — (inferred) model identifier selected in model-configs; set to match your provider/model; flows: Plant Care.
  • LAMATIC_DEPLOYMENT_ENDPOINT — (inferred) the base URL for the deployed GraphQL/API endpoint; obtain from Lamatic Studio deployment; flows: Plant Care.

Quickstart

  1. Deploy or run the AgentKit template Plant Care from Lamatic Studio: https://studio.lamatic.ai/template/plant-care.
  2. Configure the LLM provider in model-configs and set the required provider credentials in your runtime environment (for example, LLM_PROVIDER_API_KEY).
  3. Ensure the runtime can access the user-provided image URL (publicly reachable or accessible within your network).
  4. Invoke the flow via the deployed GraphQL endpoint using a request shaped like the trigger expects (placeholder fields shown; align field names with your deployed schema):
    • GraphQL operation (example shape):
      • mutation PlantCare($imageUrl: String!) { plantCare(imageUrl: $imageUrl) { result } }
    • Variables:
      • { "imageUrl": "https://example.com/path/to/plant-photo.jpg" }
  5. Inspect the response and validate that it is strictly formatted JSON per the prompt contract.
  6. Store or render the returned structured care guide in your application.

Common Failure Modes

Symptom Likely Cause Fix
API returns an error before reaching the model GraphQL schema mismatch or missing required input field Confirm the deployed GraphQL operation name and required arguments; update the caller to match the graphqlNode schema
Output is not valid JSON (extra text, trailing commas, markdown) Model deviated from the JSON-only prompt contract Tighten prompt constraints, add JSON validation and retry-on-invalid-JSON logic, or post-process with a strict JSON repair step
Plant identification is vague or incorrect Image is low quality, ambiguous species, or model uncertainty Provide clearer images (good lighting, close-up of leaves/flowers), allow the model to express uncertainty, or add a follow-up question flow
Image link cannot be analyzed URL is not publicly accessible, requires auth, or times out Use publicly reachable HTTPS URLs, provide signed URLs, or host images where the runtime can access them
High latency/timeouts Slow image fetch, large images, or overloaded LLM provider Reduce image size, improve hosting/CDN, increase timeouts, add retries/backoff, or switch to a faster model

Notes

  • Project type: template (single flow) with a mandatory step plant-care.
  • Repository: https://github.com/Lamatic/AgentKit/tree/main/kits/plant-care.
  • Directories present: constitutions, flows, model-configs, prompts, scripts.
  • Default constitution applies, including identity, safety, data handling, and tone constraints.