{{education feature}}
{{Infobox entity
| image = Agent.png 
|imagesize=100px
|invimage=Agent Spawn Egg
| health = ∞
| behavior = Passive
| mobtype = [[Golem]]
| damage = {{hp|5}}
| size = Height: 0.93 blocks<br>Width: 0.6 blocks
| spawn =  See [[#Usage|Usage]]
}}
The '''Agent''' is a interactive [[passive mob]] that is exclusive to {{el|ee}} and {{el|be}}.

In {{el|ee}} and {{el|be}} worlds connected to a WebSocket server, the '''agent''' is a mob that helps [[player]]s learn coding, by getting players to code the actions on it. The agent can be programmed to execute several tasks, like planting and harvesting, mining, chopping trees, and building.

In a {{el|be}} world not connected to a WebSocket server, it is [[Bedrock Edition unused features|unused]] and thus has no AI unless spawned by putting the command <code>execute @p ~ ~ ~ agent create</code> or in 1.19.10+ you can summon with <code>execute as @p run agent create</code> into an [[NPC]], but can still store items given to it by the player in its inventory. It can also teleport between dimensions with the player. 

The agent can be spawned with its spawn egg, obtainable with <code>[[Commands/give|/give]] @s spawn_egg 1 56</code>. However, it is completely invisible when spawned via the spawn egg.

== Usage ==
In ''Minecraft Education'', the agent is used in conjunction with [[Code Connection|Code Connection for ''Minecraft'' / Code Builder]], and is programmable by a {{w|visual programming language}}.

In ''Education'' and ''Bedrock Editions'', the agent can be used in conjunction with WebSocket servers. 

The agent carries its own 27-item [[inventory]], which can be manipulated by [[command]]s that the [[player]] programs it to use, or edited directly by a GUI that the player can access in-game, in any dimension.

The visual interface allows the player to drag and drop commands, structural constructs and other components into a sequence, and associate the sequence with a custom-named slash command, which can be executed in the traditional way, from the console.

[[File:Agent Flying.png|thumb|The agent in a [[dripstone cave]]]]
The agent can push pressure plates. The agent also is invulnerable to attacks and is targeted by [[warden]]s, but the agent remains undamaged. Projectiles pass through them. Agents can also never ride [[minecart]]s or [[boat]]s, and vehicles go through them. The player cannot use a lead on them.

The agent can interact with buttons, levers or other right-click mechanisms like doors and gates.  

=== Agent commands ===
{{main|Commands/agent}}
* <code>attack &lt;direction&gt;</code>
* <code>destroy &lt;direction&gt;</code>
* <code>drop &lt;int:slotNum&gt; &lt;int:quantity&gt; &lt;direction&gt;</code>
* <code>drop all &lt;direction&gt;</code>
* <code>move &lt;direction&gt;</code>
* <code>turn &lt;turnDirection&gt;</code>
* <code>inspect &lt;direction&gt;</code>
* <code>inspect data &lt;direction&gt;</code>
* <code>detect &lt;direction&gt;</code>
* <code>detectredstone &lt;direction&gt;</code>
* <code>transfer &lt;int:srcSlotNum&gt; &lt;int:quantity&gt; &lt;int:dstSlotNum&gt;</code>
* <code>create agent</code>
* <code>remove agent</code>
* <code>teleport to player</code>
* <code>teleport to location facing direction</code>
* <code>collect &lt;string:item&gt;</code>
* <code>till &lt;direction&gt;</code>
* <code>place &lt;int:slotNum&gt; &lt;direction&gt;</code>
* <code>place on move&lt;int:slotNum&gt; &lt;true/false&gt;</code>
* <code>get item count &lt;int:slotNum&gt;</code>
* <code>get item space &lt;int:slotNum&gt;</code>
* <code>get item detail &lt;int:slotNum&gt;</code>

<code>&lt;direction&gt;</code> refers to <code>forward|back|left|right|up|down</code>

<code>&lt;turnDirection&gt;</code> refers to <code>left|right</code>

== Sounds ==

{{SoundTable
| type = bedrock
| {{SoundLine
| sound =Anvil land.ogg
|source=neutral
| description = When an agent is spawned
| id = mob.agent.spawn
}}
}}

== Data values ==
=== ID ===
{{ID table
|edition=bedrock
|shownumericids=y
|generatetranslationkeys=y
|displayname=Agent
|spritetype=entity
|nameid=agent
|id=56
|foot=1}}

== History ==
{{HistoryTable
|{{HistoryLine|pocket alpha}}
|{{HistoryLine||v0.16.0|dev=build 1|[[File:Agent.png|32px]] Added agent.}}
|{{HistoryLine|||dev=build 2|Removed agent.}}
|{{HistoryLine|pocket}}
|{{HistoryLine||1.0.0|dev=alpha 0.17.0.1|The agent has been re-added, hidden in a(n) <code>.apk</code> file.}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.8.0|dev=beta 1.8.0.8|Added agent [[spawn egg]] texture file.}}
|{{HistoryLine||1.9.0|dev=beta 1.9.0.0|Agent can now be spawned by putting the command <code>execute @p ~ ~ ~ agent create</code> into an npc. }}
|{{HistoryLine|education}}
|{{HistoryLine||1.0.1|[[File:Agent.png|32px]] Added the "learn to code mascot".}}
|{{HistoryLine||1.0.2|The entity ID changed has been changed from "learn_to_code_mascot" to "agent".}}
|{{HistoryLine||1.4.0|Agent's default name tag color has been changed to blue.}}
|{{HistoryLine||1.7|Agent can now be removed through {{cmd|remove}}.
|[[Player]]s now can show the agent coordinates on the [[HUD]].
|{{cmd|summon agent}} now creates or teleports the executor's agent to the executor.
|Added spawn eggs for agents.}}
|{{HistoryLine||1.20.12|dev=1.20.10.0|Agent now has no range restrictions, it can move and build far away from the player.
|Agent now has an animation for unsuccessful actions.
|Agent now chooses which item to detect or interact with in a “line of sight” in the direction the code specified, up to 1 block away.}}
}}

== Issues ==
{{issue list|projects=mcpe}}

== Trivia ==
*In [[10 Years of Minecraft]], there is a puzzle in the "Library" area that involves controlling the agent with [[glazed terracotta]]. On the {{BE}} version of the map, the agent is added in as a new mob, while on {{JE}}, it is an [[armor stand]] with remodeled [[infested chiseled stone bricks]] on its head.

== Gallery ==
=== Screenshots ===
<gallery>
File:Agent - 1.png|An agent.
File:Some passive mobs.png|The agent with other passive mobs.
File:Education Edition mobs.png|An agent alongside a [[NPC]] and [[camera]] in a tutorial world.
File:Time agent1.png|Red-eyed version of Agent in [[hour of code]] 2021
File:Time agent2.png|Yellow-eyed version of Agent in [[hour of code]] 2021
File:Time agent0.png|Green-eyed version of Agent in [[hour of code]] 2021
File:Time agent3.png|Blue-eyed version of Agent in [[hour of code]] 2021
File:Time agent4.png|Pink-eyed version of Agent in [[hour of code]] 2021
</gallery>

=== In other media ===
<gallery>
File:Code Builder Update.png|Agent in an official render.
File:Learn to Code Update.png|An agent in promotional artwork for the [[Learn to Code Update]].
File:GOAT Update.jpg|An agent in promotional artwork for the [[GOAT Update]].
File:Mobile, Multiplayer & More.png|An agent in promotional artwork for [[Mobile, Multiplayer & More]].
File:Education Poster.png|The agent in a promotional artwork.
File:InspirationIsland screenshot 0.jpg|A statue of an agent in [[Inspiration Island]].
File:Nitwit Ravager Agent.jpeg|An agent with a [[nitwit]] and [[ravager]].
</gallery>

== External links ==
*[https://education.minecraft.net/en-us/lessons/build-with-the-agent Build with the agent] – Minecraft.net on February 24, 2022

== Navigation ==
{{Navbox mobs}}
{{Navbox Education|exclusive}}

[[Category:Passive mobs]]
[[Category:Flying mobs]]
[[Category:Minecraft Education mobs]]

[[de:Agent]]
[[es:Agente]]
[[fr:Agent]]
[[ja:エージェント]]
[[ko:에이전트]]
[[pl:Agent]]
[[pt:Agente]]
[[ru:Агент]]
[[th:เอเจนต์]]
[[zh:智能体]]
