# Example: social sentiment agent

> Build a social media sentiment analysis agent end to end with a coding agent, from initial scaffold through evaluation, publish, and wiring as a sub-agent.

This example walks through the full agent development lifecycle using a low-code agent that analyzes sentiment in social media comments. It covers every stage: scaffold, configure, add a tool, evaluate, publish, and wire as a sub-agent inside a social media manager agent.

## Prerequisites

- The `uipath-agents` skill installed for your coding agent. See [Install and set up](https://docs.uipath.com/coding-agents/standalone/latest/user-guide/install-and-set-up).
- A logged-in session (`uip login`).

## Step 1: Scaffold the agent

Open your coding agent in an empty folder and ask:

> Create a new sentiment analysis agent for social media inbound comments. The agent should accept a comment as input and return a sentiment classification (positive, neutral, or negative) with a confidence score.

The coding agent runs `uip agent init` and creates the full project structure, including `agent.json`, `project.json`, `entry-points.json`, and a default evaluation set.

## Step 2: Configure prompts and schema

Review the generated `agent.json` and refine it conversationally:

> Update the system prompt to classify sentiment on a 5-point scale (very negative, negative, neutral, positive, very positive) and add a brief reasoning field to the output schema.

The coding agent edits `agent.json`, runs `uip agent refresh` to regenerate derived artifacts, then `uip agent validate` to confirm the schemas are consistent.

## Step 3: Add a tool

Connect the agent to an Integration Service connector:

> Add a Slack connector tool so the agent can post the sentiment result to a Slack channel.

The coding agent creates a `resource.json` under `resources/slack-post/`, then runs `uip agent refresh` and `uip agent validate` to sync the tool into the agent entry points.

## Step 4: Push to Studio Web and run locally

> Push the agent to Studio Web so I can review the configuration.

The coding agent runs `uip solution upload`, which uploads the project. From Studio Web, run **Debug** to test the agent against a sample comment before building evaluation sets.

## Step 5: Evaluate

> Create an evaluation set called regression-tests with five test cases covering positive, negative, and neutral comments. Run it and show me the results.

The coding agent creates the test cases in `evals/eval-sets/`, runs the evaluation set, and returns the per-test-case scores. If a test case falls below threshold:

> The third test case scored below 0.7 — update the system prompt to make the classification criteria more explicit and re-run.

Iterate until the evaluation set passes consistently.

## Step 6: Publish

> Publish the sentiment agent to my personal workspace.

The coding agent runs `uip solution pack` followed by `uip solution publish`. The agent is now a process in your Orchestrator personal workspace.

## Step 7: Wire as a sub-agent

To use the sentiment agent as a tool inside a social media manager agent:

> Create a social media manager agent that uses the sentiment analysis agent as a tool to handle a batch of inbound comments and generate a summary report.

The coding agent scaffolds a new manager agent project and registers the sentiment agent as a sub-agent tool using `--type agent`. Follow the same refresh → validate → upload → deploy steps above.

**Result:** A two-agent solution where the manager agent delegates sentiment classification to the sentiment sub-agent and compiles the results into a report.

## See also

- [Build agents with Coding Agents](building-agents-with-coding-agents.md) — overview and 8-step developer journey.
- [Build low-code agents with Coding Agents](building-low-code-agents-with-coding-agents.md) — full reference for the low-code agent build loop.
- [Build coded agents with Coding Agents](building-coded-agents-with-coding-agents.md) — Python-based coded agents from a coding agent terminal.
